Package org.atlanmod.commons.collect
Class Path<T>
- java.lang.Object
-
- org.atlanmod.commons.collect.Path<T>
-
- Type Parameters:
T- The type of the path elements
@ParametersAreNonnullByDefault public class Path<T> extends Object
This data structure can represent a sequence o elements, such as: - File paths: "/usr/local/bin" - Domain names: "org.atlanmod.commons" - Namespaces: "java.util.function.BiFunction"
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)inthashCode()Thead()Returns the head, i.e., the first element (0) of the pathTlast()Returns the last element (length -1) of the pathstatic <E> Path<E>of(E... values)Creates a new Path from a sequence of valuesintsize()Returns the number of elements composing this PathPath<T>tail()StringtoString()
-
-
-
Method Detail
-
size
public int size()
Returns the number of elements composing this Path- Returns:
- the size of this path
-
last
public T last()
Returns the last element (length -1) of the path- Returns:
- the last element
-
head
public T head()
Returns the head, i.e., the first element (0) of the path- Returns:
- the first element
-
of
@SafeVarargs public static <E> Path<E> of(E... values)
Creates a new Path from a sequence of values- Type Parameters:
E- The type of the path elements- Parameters:
values- The elements of the path- Returns:
- the type of the path elements
-
-