Package io.github.connellite.collections
Record Class DelegatingNullSkippingCollection<T>
java.lang.Object
java.lang.Record
io.github.connellite.collections.DelegatingNullSkippingCollection<T>
- All Implemented Interfaces:
Iterable<T>,Collection<T>
public record DelegatingNullSkippingCollection<T>(Collection<T> delegate)
extends Record
implements Collection<T>
Collection view over a delegate: add(T) / addAll(java.util.Collection<? extends T>) ignore null elements (no-op / not counted as changed).-
Constructor Summary
ConstructorsConstructorDescriptionDelegatingNullSkippingCollection(Collection<T> delegate) Creates an instance of aDelegatingNullSkippingCollectionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanaddAll(Collection<? extends T> c) voidclear()booleanbooleancontainsAll(Collection<?> c) delegate()Returns the value of thedelegaterecord component.booleanIndicates whether some other object is "equal to" this one.voidfinal inthashCode()Returns a hash code value for this object.booleanisEmpty()iterator()booleanbooleanremoveAll(Collection<?> c) booleanbooleanretainAll(Collection<?> c) intsize()stream()Object[]toArray()<E> E[]toArray(E[] a) toString()Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
toArray
-
Constructor Details
-
DelegatingNullSkippingCollection
Creates an instance of aDelegatingNullSkippingCollectionrecord class.- Parameters:
delegate- the value for thedelegaterecord component
-
-
Method Details
-
size
public int size()- Specified by:
sizein interfaceCollection<T>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceCollection<T>
-
contains
- Specified by:
containsin interfaceCollection<T>
-
iterator
-
toArray
- Specified by:
toArrayin interfaceCollection<T>
-
toArray
public <E> E[] toArray(E[] a) - Specified by:
toArrayin interfaceCollection<T>
-
add
- Specified by:
addin interfaceCollection<T>
-
remove
- Specified by:
removein interfaceCollection<T>
-
containsAll
- Specified by:
containsAllin interfaceCollection<T>
-
addAll
- Specified by:
addAllin interfaceCollection<T>
-
removeAll
- Specified by:
removeAllin interfaceCollection<T>
-
retainAll
- Specified by:
retainAllin interfaceCollection<T>
-
clear
public void clear()- Specified by:
clearin interfaceCollection<T>
-
removeIf
- Specified by:
removeIfin interfaceCollection<T>
-
forEach
-
spliterator
- Specified by:
spliteratorin interfaceCollection<T>- Specified by:
spliteratorin interfaceIterable<T>
-
stream
- Specified by:
streamin interfaceCollection<T>
-
parallelStream
- Specified by:
parallelStreamin interfaceCollection<T>
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object).- Specified by:
equalsin interfaceCollection<T>- Specified by:
equalsin classRecord- Parameters:
o- the object with which to compare- Returns:
trueif this object is the same as theoargument;falseotherwise.
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components.- Specified by:
hashCodein interfaceCollection<T>- Specified by:
hashCodein classRecord- Returns:
- a hash code value for this object
-
delegate
Returns the value of thedelegaterecord component.- Returns:
- the value of the
delegaterecord component
-