Class CardArrayList
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<Card>,Collection<Card>,List<Card>,CardList
An implementation of
CardList for easy shuffling, choosing and uniqueness testing of lists of cards.-
Field Summary
Fields inherited from class java.util.AbstractList
modCount -
Constructor Summary
ConstructorsConstructorDescriptionCardArrayList(Collection<? extends Card> cards) Creates this instance from an existing list of cards. -
Method Summary
Modifier and TypeMethodDescriptionbooleanAdds all the cards from the given list.Adds the card fluently.clone()CallsCard.clone()on every card in this list and returns a new copy of this list.booleanChecks if the list has the specific reference to a card.get(int index) Gets a card at the specified index.intgetCount()Gets the size of this list.booleanisEmpty()Checks if the instance is empty.iterator()Provides support for Java language features that require anIteratorGets the first card in this instance.remove(int index) booleanbooleanRemoves the specified card instance by reference.voidRemoves all the cards from this instance.Removes the first card.booleanReplaces a card by index.shuffle()Deprecated.shuffle(XORShiftRandom random) Shuffles the instance with the given random number generator.intsize()stream()Gets theStreamAPI representation of this card list.toList()Gets aListthat references the contents of this instance.Methods inherited from class java.util.AbstractList
add, addAll, clear, equals, hashCode, indexOf, lastIndexOf, listIterator, listIterator, removeRange, subListMethods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, removeAll, retainAll, toArray, toArray, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.demilich.metastone.game.cards.CardList
addCard, containsCard, containsCard, filtered, getCopy, hasCardOfType, peekMethods inherited from interface java.util.Collection
parallelStream, removeIf, toArrayMethods inherited from interface java.util.List
add, addAll, addAll, clear, contains, containsAll, equals, hashCode, indexOf, lastIndexOf, listIterator, listIterator, removeAll, replaceAll, retainAll, sort, spliterator, subList, toArray, toArray
-
Constructor Details
-
CardArrayList
public CardArrayList() -
CardArrayList
Creates this instance from an existing list of cards.- Parameters:
cards- The list of cards.
-
-
Method Details
-
add
- Specified by:
addin interfaceCollection<Card>- Specified by:
addin interfaceList<Card>- Overrides:
addin classAbstractList<Card>
-
stream
Description copied from interface:CardListGets theStreamAPI representation of this card list.- Specified by:
streamin interfaceCardList- Specified by:
streamin interfaceCollection<Card>- Returns:
- The backing list's
Collection.stream().
-
addCard
Description copied from interface:CardListAdds the card fluently. -
addAll
Description copied from interface:CardListAdds all the cards from the given list. -
clone
Description copied from interface:CardListCallsCard.clone()on every card in this list and returns a new copy of this list. -
set
-
contains
Description copied from interface:CardListChecks if the list has the specific reference to a card. Does not use the card'sEntity.idor itsCard.getCardId(), which may be more helpful. -
get
Description copied from interface:CardListGets a card at the specified index. -
getCount
public int getCount()Description copied from interface:CardListGets the size of this list. -
isEmpty
public boolean isEmpty()Description copied from interface:CardListChecks if the instance is empty. -
iterator
Description copied from interface:CardListProvides support for Java language features that require anIterator -
size
public int size()- Specified by:
sizein interfaceCollection<Card>- Specified by:
sizein interfaceList<Card>- Specified by:
sizein classAbstractCollection<Card>
-
peekFirst
Description copied from interface:CardListGets the first card in this instance. -
remove
- Specified by:
removein interfaceCollection<Card>- Specified by:
removein interfaceList<Card>- Overrides:
removein classAbstractCollection<Card>
-
remove
Description copied from interface:CardListRemoves the specified card instance by reference. -
remove
-
removeAll
public void removeAll()Description copied from interface:CardListRemoves all the cards from this instance. -
removeFirst
Description copied from interface:CardListRemoves the first card. ImplementsPutRandomSecretIntoPlaySpell, used by 3 Hearthstone cards.- Specified by:
removeFirstin interfaceCardList- Returns:
- The card that is now removed.
-
replace
Description copied from interface:CardListReplaces a card by index. -
shuffle
Deprecated. -
shuffle
Description copied from interface:CardListShuffles the instance with the given random number generator.- Specified by:
shufflein interfaceCardList- Parameters:
random- AXORShiftRandominstance.
-
toList
Description copied from interface:CardListGets aListthat references the contents of this instance.
-