Ejemplo n.º 1
0
 @Override
 public Array<T> slice(long beginIndex, long endIndex) {
   if (beginIndex >= endIndex || beginIndex >= length() || isEmpty()) {
     return empty();
   }
   if (beginIndex <= 0 && endIndex >= length()) {
     return this;
   }
   final int index = Math.max((int) beginIndex, 0);
   final int length = Math.min((int) endIndex, length()) - index;
   final Object[] arr = new Object[length];
   System.arraycopy(delegate, index, arr, 0, length);
   return wrap(arr);
 }
Ejemplo n.º 2
0
 @Override
 public Array<Array<T>> combinations(int k) {
   return Combinations.apply(this, Math.max(k, 0));
 }