Record Class IdNonEmptyList<T>
java.lang.Object
java.lang.Record
com.io7m.idstore.model.IdNonEmptyList<T>
- Type Parameters:
T- The type of elements- Record Components:
first- The first elementrest- The rest of the elements
- All Implemented Interfaces:
Iterable<T>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanfinal booleanIndicates whether some other object is "equal to" this one.first()Returns the value of thefirstrecord component.final inthashCode()Returns a hash code value for this object.iterator()static <T> IdNonEmptyList<T> The list as a non-empty list.rest()Returns the value of therestrecord component.static <T> IdNonEmptyList<T> single(T x) Create a one-element list.intsize()toList()final StringtoString()Returns a string representation of this record class.Methods inherited from interface Iterable
forEach, spliterator
-
Constructor Details
-
IdNonEmptyList
-
-
Method Details
-
single
Create a one-element list.- Type Parameters:
T- The type of elements- Parameters:
x- The element- Returns:
- The result list
-
toList
-
ofList
The list as a non-empty list.- Type Parameters:
T- The type of elements- Parameters:
items- The list elements- Returns:
- The list
- Throws:
IdValidityException- On empty lists
-
contains
- Parameters:
email- The email address- Returns:
trueif the list contains the given email
-
iterator
-
size
public int size()- Returns:
- The list size
-
toString
-
hashCode
-
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). -
first
-
rest
-