V
- Object valuepublic final class Wrapper<V> extends Object implements Comparable<Wrapper<V>>
hash()
, equals()
and compareTo()
methods
Person p1 = new Person(1, "A"); Person p2 = new Person(1, "B"); Wrapper<Person> w1 = Wrapper.of(p1, Person::getId, Person::getName); Wrapper<Person> w2 = w1.wrap(p2); assertTrue(w1.compareTo(w2) < 0);
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Wrapper<V> wrapper)
Compares this object with the specified object for order.
|
boolean |
equals(Object o) |
V |
getValue()
Returns the original value
|
int |
hashCode() |
static <D,P> Wrapper<D> |
of(D value,
boolean nullFirst,
Function<D,P>... functions)
Create a new wrapper
|
static <D,P> Wrapper<D> |
of(D value,
Function<D,P>... functions)
Create a new wrapper
|
String |
toString() |
Wrapper<V> |
wrap(V value)
Create a new wrapper for the value
|
public int compareTo(@Nullable Wrapper<V> wrapper)
compareTo
in interface Comparable<Wrapper<V>>
public static final <D,P> Wrapper<D> of(@Nonnull D value, @Nonnull Function<D,P>... functions)
Copyright 2019-2022, Pavel Ponec