Esempio n. 1
1
 @Override
 default <U> Tree<Tuple2<T, U>> zipAll(Iterable<U> that, T thisElem, U thatElem) {
   Objects.requireNonNull(that, "that is null");
   if (isEmpty()) {
     return Iterator.ofAll(that).map(elem -> Tuple.of(thisElem, elem)).toTree();
   } else {
     final java.util.Iterator<U> thatIter = that.iterator();
     final Tree<Tuple2<T, U>> tree = ZipAll.apply((Node<T>) this, thatIter, thatElem);
     if (thatIter.hasNext()) {
       final Iterable<Node<Tuple2<T, U>>> remainder =
           Iterator.ofAll(thatIter).map(elem -> Tree.of(Tuple.of(thisElem, elem)));
       return new Node<>(tree.getValue(), tree.getChildren().appendAll(remainder));
     } else {
       return tree;
     }
   }
 }
Esempio n. 2
1
 /**
  * Creates a Array based on the elements of a short array.
  *
  * @param array a short array
  * @return A new Array of Short values
  */
 public static Array<Short> ofAll(short[] array) {
   Objects.requireNonNull(array, "array is null");
   return ofAll(Iterator.ofAll(array));
 }
Esempio n. 3
1
 /**
  * Creates a Array based on the elements of an int array.
  *
  * @param array an int array
  * @return A new Array of Integer values
  */
 public static Array<Integer> ofAll(int[] array) {
   Objects.requireNonNull(array, "array is null");
   return ofAll(Iterator.ofAll(array));
 }
Esempio n. 4
1
 /**
  * Creates a Array based on the elements of a long array.
  *
  * @param array a long array
  * @return A new Array of Long values
  */
 public static Array<Long> ofAll(long[] array) {
   Objects.requireNonNull(array, "array is null");
   return ofAll(Iterator.ofAll(array));
 }
Esempio n. 5
1
 /**
  * Creates a Array based on the elements of a double array.
  *
  * @param array a double array
  * @return A new Array of Double values
  */
 public static Array<Double> ofAll(double[] array) {
   Objects.requireNonNull(array, "array is null");
   return ofAll(Iterator.ofAll(array));
 }
Esempio n. 6
1
 /**
  * Creates a Array based on the elements of a char array.
  *
  * @param array a char array
  * @return A new Array of Character values
  */
 public static Array<Character> ofAll(char[] array) {
   Objects.requireNonNull(array, "array is null");
   return ofAll(Iterator.ofAll(array));
 }
Esempio n. 7
1
 /**
  * Creates a Array based on the elements of a boolean array.
  *
  * @param array a boolean array
  * @return A new Array of Boolean values
  */
 public static Array<Boolean> ofAll(boolean[] array) {
   Objects.requireNonNull(array, "array is null");
   return ofAll(Iterator.ofAll(array));
 }
Esempio n. 8
1
 /**
  * Creates a Vector based on the elements of a float array.
  *
  * @param array a float array
  * @return A new Vector of Float values
  */
 public static Vector<Float> ofAll(float[] array) {
   Objects.requireNonNull(array, "array is null");
   return Vector.ofAll(Iterator.ofAll(array));
 }
Esempio n. 9
1
 /**
  * Creates a Vector based on the elements of a byte array.
  *
  * @param array a byte array
  * @return A new Vector of Byte values
  */
 public static Vector<Byte> ofAll(byte[] array) {
   Objects.requireNonNull(array, "array is null");
   return Vector.ofAll(Iterator.ofAll(array));
 }