Package fj.data.vector
Class V4<A>
java.lang.Object
fj.data.vector.V4<A>
- All Implemented Interfaces:
Iterable<A>
A vector-4.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription__1()
A first-class function to get the first element of a vector.__2()
A first-class function to get the second element of a vector.__3()
A first-class function to get the third element of a vector.__4()
A first-class function to get the fourth element of a vector._1()
Returns the first element of this vector._2()
Returns the second element of this vector._3()
Returns the third element of this vector._4()
Returns the fourth element of this vector.<B> V4
<B> Performs function application within a vector (applicative functor pattern).static <A> V4
<A> Creates a vector-4 from a head and a tail.final boolean
final int
hashCode()
head()
Returns the first element of this vector, as a product-1.iterator()
Returns an iterator for the elements of this vector.<B> V4
<B> Maps the given function across this vector.p()
Returns a homogeneous product-4 equivalent to this vector.static <A> V4
<A> Creates a vector-4 from a homogeneous product-4.p_()
Returns a function that transforms a vector-4 to the equivalent product-4.tail()
Returns all but the first element of this vector, as a vector-3.toArray()
Returns an array with the elements of this vector.Returns a nonempty list with the elements of this vector.toStream()
Returns a stream of the elements of this vector.Returns a function that transforms a vector-4 to a stream of its elements.Zips this vector with the given vector to produce a vector of vectors.Zips this vector with the given vector to produce a vector of pairs.<B,
C> V4 <C> Zips this vector with the given vector using the given function to produce a new vector.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
tail
-
head
-
-
Constructor Details
-
V4
-
-
Method Details
-
equals
-
hashCode
public final int hashCode() -
p
Creates a vector-4 from a homogeneous product-4.- Parameters:
p
- The product-4 from which to create a vector.- Returns:
- A new vector-4.
-
cons
Creates a vector-4 from a head and a tail.- Parameters:
head
- The value to put as the first element of the vector.tail
- The vector representing all but the first element of the new vector.- Returns:
- The new vector.
-
_1
Returns the first element of this vector.- Returns:
- the first element of this vector.
-
_2
Returns the second element of this vector.- Returns:
- the second element of this vector.
-
_3
Returns the third element of this vector.- Returns:
- the third element of this vector.
-
_4
Returns the fourth element of this vector.- Returns:
- the fourth element of this vector.
-
tail
Returns all but the first element of this vector, as a vector-3.- Returns:
- all but the first element of this vector, as a vector-3.
-
head
Returns the first element of this vector, as a product-1.- Returns:
- the first element of this vector, as a product-1.
-
iterator
Returns an iterator for the elements of this vector. -
p
Returns a homogeneous product-4 equivalent to this vector.- Returns:
- a homogeneous product-4 equivalent to this vector.
-
toNonEmptyList
Returns a nonempty list with the elements of this vector.- Returns:
- a nonempty list with the elements of this vector.
-
toStream
Returns a stream of the elements of this vector.- Returns:
- a stream of the elements of this vector.
-
toArray
Returns an array with the elements of this vector.- Returns:
- an array with the elements of this vector.
-
map
Maps the given function across this vector.- Parameters:
f
- The function to map across this vector.- Returns:
- A new vector after the given function has been applied to each element.
-
apply
Performs function application within a vector (applicative functor pattern).- Parameters:
vf
- The vector of functions to apply.- Returns:
- A new vector after zipping the given vector of functions over this vector.
-
zipWith
Zips this vector with the given vector using the given function to produce a new vector.- Parameters:
f
- The function to zip this vector and the given vector with.bs
- The vector to zip this vector with.- Returns:
- A new vector with the results of the function.
-
zip
Zips this vector with the given vector to produce a vector of pairs.- Parameters:
bs
- The vector to zip this vector with.- Returns:
- A new vector with a length the same as the shortest of this vector and the given vector.
-
vzip
Zips this vector with the given vector to produce a vector of vectors.- Parameters:
bs
- The vector to zip this vector with.- Returns:
- A new vector of vectors.
-
toStream_
Returns a function that transforms a vector-4 to a stream of its elements.- Returns:
- a function that transforms a vector-4 to a stream of its elements.
-
p_
Returns a function that transforms a vector-4 to the equivalent product-4.- Returns:
- a function that transforms a vector-4 to the equivalent product-4.
-
__1
A first-class function to get the first element of a vector.- Returns:
- a function that gets the first element of a given vector.
-
__2
A first-class function to get the second element of a vector.- Returns:
- a function that gets the second element of a given vector.
-
__3
A first-class function to get the third element of a vector.- Returns:
- a function that gets the third element of a given vector.
-
__4
A first-class function to get the fourth element of a vector.- Returns:
- a function that gets the fourth element of a given vector.
-