update comments

This commit is contained in:
Anthony Calosa
2024-12-04 22:12:22 +08:00
parent 36f0021cae
commit 8e16456b2e

View File

@@ -59,8 +59,7 @@ public class FCollection<T> implements List<T>, /*Set<T>,*/ FCollectionView<T>,
/**
* Create an {@link FCollection} containing a single element.
*
* @param e
* the single element the new collection contains.
* @param e the single element the new collection contains.
*/
public FCollection(final T 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
* the array is preserved in the new collection.
*
* @param c
* an array, whose elements will be in the collection upon its
* @param c an array, whose elements will be in the collection upon its
* creation.
*/
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
* elements in the iterable is preserved in the new collection.
*
* @param i
* an iterable, whose elements will be in the collection upon its
* @param i an iterable, whose elements will be in the collection upon its
* creation.
*/
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}.
*
* @param reader
* a reader used to populate collection
* @param reader a reader used to populate collection
*/
public FCollection(final FCollectionReader<T> reader) {
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
* returning {@code false} when {@code null} is passed as an argument.
*
* @param iterable
* a card collection.
* @param iterable a card collection.
*/
public static boolean hasElements(final Iterable<?> 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
* returning {@code false} when {@code null} is passed as the first argument.
*
* @param collection
* a collection.
* @param element
* a possible element of the collection.
* @param collection a collection.
* @param element a possible element of the collection.
*/
public static <T> boolean hasElement(final Collection<T> collection, final T 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}.
*
* @throws NoSuchElementException
* if the collection is empty.
*/
@Override
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}.
*
* @throws NoSuchElementException
* if the collection is empty.
*/
@Override
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.
*
* @param o
* an object.
* @param o an object.
*/
@Override
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.
*
* @param e
* the object to add.
* @param e the object to add.
*
* @return whether the collection changed as a result of this method call.
*/
@Override
@@ -268,8 +254,8 @@ public class FCollection<T> implements List<T>, /*Set<T>,*/ FCollectionView<T>,
/**
* Remove an element from this collection.
*
* @param o
* the object to remove.
* @param o the object to remove.
*
* @return whether the collection changed as a result of this method call.
*/
@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
* collection, in the order in which they appear.
*
* @param i
* an iterator.
* @param i an iterator.
*
* @return whether this collection changed as a result of this method call.
* @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,
* respecting the ordering.
*
* @param c
* an array.
* @param c an array.
*
* @return whether this collection changed as a result of this method call.
*/
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}.
*
* @param c
* an iterable.
* @param c an iterable.
*
* @return whether this collection changed as a result of this method call.
*/
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.
*
* @param index
* the index to insert the element at.
* @param element
* the element to insert.
* @param index the index to insert the element at.
*
* @param element the element to insert.
*
* @return whether this collection changed as a result of this method call.
*/
private boolean insert(int index, final T element) {
@@ -553,7 +539,7 @@ public class FCollection<T> implements List<T>, /*Set<T>,*/ FCollectionView<T>,
*/
@Override
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));
}