org.entityfs.support.util
Class Pair<T>
java.lang.Object
org.entityfs.support.util.TwoObjects<T,T>
org.entityfs.support.util.Pair<T>
- All Implemented Interfaces:
- Iterable<T>
public class Pair<T>
- extends TwoObjects<T,T>
- implements Iterable<T>
This is an immutable value object that contains a pair of objects of the same
type.
- Since:
- 1.0
- Author:
- Karl Gustafsson
- See Also:
TwoObjects
- In_jar:
- entityfs-core
Constructor Summary |
Pair(T first,
T second)
Create the pair. |
Pair
public Pair(T first,
T second)
- Create the pair.
- Parameters:
first
- The first object.second
- The second object.
getAsList
public List<T> getAsList()
- Get a list with the two objects in a collection. The first object in the
list is the first object in the pair, the second the second.
- Returns:
- A list with the two objects.
iterator
public Iterator<T> iterator()
- Get an iterator. The iterator will first return the first element and
then the second element.
- Specified by:
iterator
in interface Iterable<T>
- Returns:
- An iterator over the two elements.