mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
update comments
This commit is contained in:
@@ -59,8 +59,7 @@ public class FCollection<T> implements List<T>, /*Set<T>,*/ FCollectionView<T>,
|
|||||||
/**
|
/**
|
||||||
* Create an {@link FCollection} containing a single element.
|
* Create an {@link FCollection} containing a single element.
|
||||||
*
|
*
|
||||||
* @param e
|
* @param e the single element the new collection contains.
|
||||||
* the single element the new collection contains.
|
|
||||||
*/
|
*/
|
||||||
public FCollection(final T e) {
|
public FCollection(final T e) {
|
||||||
add(e);
|
add(e);
|
||||||
@@ -70,8 +69,7 @@ public class FCollection<T> implements List<T>, /*Set<T>,*/ FCollectionView<T>,
|
|||||||
* Create an {@link FCollection} from an array. The order of the elements in
|
* Create an {@link FCollection} from an array. The order of the elements in
|
||||||
* the array is preserved in the new collection.
|
* the array is preserved in the new collection.
|
||||||
*
|
*
|
||||||
* @param c
|
* @param c an array, whose elements will be in the collection upon its
|
||||||
* an array, whose elements will be in the collection upon its
|
|
||||||
* creation.
|
* creation.
|
||||||
*/
|
*/
|
||||||
public FCollection(final T[] c) {
|
public FCollection(final T[] c) {
|
||||||
@@ -82,8 +80,7 @@ public class FCollection<T> implements List<T>, /*Set<T>,*/ FCollectionView<T>,
|
|||||||
* Create an {@link FCollection} from an {@link Iterable}. The order of the
|
* Create an {@link FCollection} from an {@link Iterable}. The order of the
|
||||||
* elements in the iterable is preserved in the new collection.
|
* elements in the iterable is preserved in the new collection.
|
||||||
*
|
*
|
||||||
* @param i
|
* @param i an iterable, whose elements will be in the collection upon its
|
||||||
* an iterable, whose elements will be in the collection upon its
|
|
||||||
* creation.
|
* creation.
|
||||||
*/
|
*/
|
||||||
public FCollection(final Iterable<? extends T> i) {
|
public FCollection(final Iterable<? extends T> i) {
|
||||||
@@ -93,8 +90,7 @@ public class FCollection<T> implements List<T>, /*Set<T>,*/ FCollectionView<T>,
|
|||||||
/**
|
/**
|
||||||
* Create an {@link FCollection} from an {@link FCollectionReader}.
|
* Create an {@link FCollection} from an {@link FCollectionReader}.
|
||||||
*
|
*
|
||||||
* @param reader
|
* @param reader a reader used to populate collection
|
||||||
* a reader used to populate collection
|
|
||||||
*/
|
*/
|
||||||
public FCollection(final FCollectionReader<T> reader) {
|
public FCollection(final FCollectionReader<T> reader) {
|
||||||
reader.readAll(this);
|
reader.readAll(this);
|
||||||
@@ -104,8 +100,7 @@ public class FCollection<T> implements List<T>, /*Set<T>,*/ FCollectionView<T>,
|
|||||||
* Check whether an {@link Iterable} contains any iterable, silently
|
* Check whether an {@link Iterable} contains any iterable, silently
|
||||||
* returning {@code false} when {@code null} is passed as an argument.
|
* returning {@code false} when {@code null} is passed as an argument.
|
||||||
*
|
*
|
||||||
* @param iterable
|
* @param iterable a card collection.
|
||||||
* a card collection.
|
|
||||||
*/
|
*/
|
||||||
public static boolean hasElements(final Iterable<?> iterable) {
|
public static boolean hasElements(final Iterable<?> iterable) {
|
||||||
return iterable != null && !Iterables.isEmpty(iterable);
|
return iterable != null && !Iterables.isEmpty(iterable);
|
||||||
@@ -115,10 +110,8 @@ public class FCollection<T> implements List<T>, /*Set<T>,*/ FCollectionView<T>,
|
|||||||
* Check whether a {@link Collection} contains a particular element, silently
|
* Check whether a {@link Collection} contains a particular element, silently
|
||||||
* returning {@code false} when {@code null} is passed as the first argument.
|
* returning {@code false} when {@code null} is passed as the first argument.
|
||||||
*
|
*
|
||||||
* @param collection
|
* @param collection a collection.
|
||||||
* a collection.
|
* @param element a possible element of the collection.
|
||||||
* @param element
|
|
||||||
* a possible element of the collection.
|
|
||||||
*/
|
*/
|
||||||
public static <T> boolean hasElement(final Collection<T> collection, final T element) {
|
public static <T> boolean hasElement(final Collection<T> collection, final T element) {
|
||||||
return collection != null && collection.contains(element);
|
return collection != null && collection.contains(element);
|
||||||
@@ -163,9 +156,6 @@ public class FCollection<T> implements List<T>, /*Set<T>,*/ FCollectionView<T>,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the first object in this {@link FCollection}.
|
* Get the first object in this {@link FCollection}.
|
||||||
*
|
|
||||||
* @throws NoSuchElementException
|
|
||||||
* if the collection is empty.
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public T getFirst() {
|
public T getFirst() {
|
||||||
@@ -177,9 +167,6 @@ public class FCollection<T> implements List<T>, /*Set<T>,*/ FCollectionView<T>,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the last object in this {@link FCollection}.
|
* Get the last object in this {@link FCollection}.
|
||||||
*
|
|
||||||
* @throws NoSuchElementException
|
|
||||||
* if the collection is empty.
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public T getLast() {
|
public T getLast() {
|
||||||
@@ -212,8 +199,7 @@ public class FCollection<T> implements List<T>, /*Set<T>,*/ FCollectionView<T>,
|
|||||||
/**
|
/**
|
||||||
* Check whether this collection contains a particular object.
|
* Check whether this collection contains a particular object.
|
||||||
*
|
*
|
||||||
* @param o
|
* @param o an object.
|
||||||
* an object.
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean contains(final Object o) {
|
public boolean contains(final Object o) {
|
||||||
@@ -250,8 +236,8 @@ public class FCollection<T> implements List<T>, /*Set<T>,*/ FCollectionView<T>,
|
|||||||
/**
|
/**
|
||||||
* Add an element to this collection, if it isn't already present.
|
* Add an element to this collection, if it isn't already present.
|
||||||
*
|
*
|
||||||
* @param e
|
* @param e the object to add.
|
||||||
* the object to add.
|
*
|
||||||
* @return whether the collection changed as a result of this method call.
|
* @return whether the collection changed as a result of this method call.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -268,8 +254,8 @@ public class FCollection<T> implements List<T>, /*Set<T>,*/ FCollectionView<T>,
|
|||||||
/**
|
/**
|
||||||
* Remove an element from this collection.
|
* Remove an element from this collection.
|
||||||
*
|
*
|
||||||
* @param o
|
* @param o the object to remove.
|
||||||
* the object to remove.
|
*
|
||||||
* @return whether the collection changed as a result of this method call.
|
* @return whether the collection changed as a result of this method call.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -312,8 +298,8 @@ public class FCollection<T> implements List<T>, /*Set<T>,*/ FCollectionView<T>,
|
|||||||
* Add all the elements in the specified {@link Iterator} to this
|
* Add all the elements in the specified {@link Iterator} to this
|
||||||
* collection, in the order in which they appear.
|
* collection, in the order in which they appear.
|
||||||
*
|
*
|
||||||
* @param i
|
* @param i an iterator.
|
||||||
* an iterator.
|
*
|
||||||
* @return whether this collection changed as a result of this method call.
|
* @return whether this collection changed as a result of this method call.
|
||||||
* @see #addAll(Collection)
|
* @see #addAll(Collection)
|
||||||
*/
|
*/
|
||||||
@@ -331,8 +317,8 @@ public class FCollection<T> implements List<T>, /*Set<T>,*/ FCollectionView<T>,
|
|||||||
* Add all the elements in the specified array to this collection,
|
* Add all the elements in the specified array to this collection,
|
||||||
* respecting the ordering.
|
* respecting the ordering.
|
||||||
*
|
*
|
||||||
* @param c
|
* @param c an array.
|
||||||
* an array.
|
*
|
||||||
* @return whether this collection changed as a result of this method call.
|
* @return whether this collection changed as a result of this method call.
|
||||||
*/
|
*/
|
||||||
public boolean addAll(final T[] c) {
|
public boolean addAll(final T[] c) {
|
||||||
@@ -378,8 +364,8 @@ public class FCollection<T> implements List<T>, /*Set<T>,*/ FCollectionView<T>,
|
|||||||
/**
|
/**
|
||||||
* Remove all objects appearing in an {@link Iterable}.
|
* Remove all objects appearing in an {@link Iterable}.
|
||||||
*
|
*
|
||||||
* @param c
|
* @param c an iterable.
|
||||||
* an iterable.
|
*
|
||||||
* @return whether this collection changed as a result of this method call.
|
* @return whether this collection changed as a result of this method call.
|
||||||
*/
|
*/
|
||||||
public boolean removeAll(final Iterable<?> c) {
|
public boolean removeAll(final Iterable<?> c) {
|
||||||
@@ -443,10 +429,10 @@ public class FCollection<T> implements List<T>, /*Set<T>,*/ FCollectionView<T>,
|
|||||||
/**
|
/**
|
||||||
* Helper method to insert an element at a particular index.
|
* Helper method to insert an element at a particular index.
|
||||||
*
|
*
|
||||||
* @param index
|
* @param index the index to insert the element at.
|
||||||
* the index to insert the element at.
|
*
|
||||||
* @param element
|
* @param element the element to insert.
|
||||||
* the element to insert.
|
*
|
||||||
* @return whether this collection changed as a result of this method call.
|
* @return whether this collection changed as a result of this method call.
|
||||||
*/
|
*/
|
||||||
private boolean insert(int index, final T element) {
|
private boolean insert(int index, final T element) {
|
||||||
@@ -553,7 +539,7 @@ public class FCollection<T> implements List<T>, /*Set<T>,*/ FCollectionView<T>,
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Iterable<T> threadSafeIterable() {
|
public Iterable<T> threadSafeIterable() {
|
||||||
//create a new linked list for iterating to make it thread safe and avoid concurrent modification exceptions
|
//create a new list for iterating to make it thread safe and avoid concurrent modification exceptions
|
||||||
return Iterables.unmodifiableIterable(new ArrayList<>(list));
|
return Iterables.unmodifiableIterable(new ArrayList<>(list));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user