Object deep copy with black list t.

@param <T>         the type parameter
@param from        the from
@param to          the to
@param blockFields the block fields
@return the t
161804
public static <T> T objectDeepCopyWithBlackList(Object from, Object to, String... blockFields) {

        if (to == null) {
            to = getNewInstance(from.getClass());
        }

        List<String> whiteList = new ArrayList<>();

        Method[] methods = from.getClass().getMethods();

        for (Method m : methods) {

            if (!isGetterMethod(m)) {
                continue;
            }

            if (isBlockFieldMethod(m, blockFields)) {
                continue;
            }

            whiteList.add(getFieldNameFromMethod(m));

        }

        return objectDeepCopyWithWhiteList(from, to, whiteList.toArray(new String[whiteList.size()]));

    }
529899
List<T> subList(long from, long to) {
        if (fullListSize > 0 && to - from > 0) {
            checkRange(from);
            // subList takes a [from;to[ range
            checkRange(to - 1);

            // check if the data of the required sub list are available
            assertSubRange(from, to - 1);

            // cannot exceed Integer.MAX_VALUE (checked by checkSubRange)
            return subList.subList((int) (from - subListOffset), (int) (to - subListOffset));
        }

        return new ArrayList<>();
    }
294308
private void copyBlock(DataInputStream in,
      VersionAndOpcode versionAndOpcode) throws IOException {
    
    // Read in the header
    CopyBlockHeader copyBlockHeader = new CopyBlockHeader(versionAndOpcode);
    copyBlockHeader.readFields(in);
    long startTime = System.currentTimeMillis();
    int namespaceId = copyBlockHeader.getNamespaceId();
    long blockId = copyBlockHeader.getBlockId();
    long genStamp = copyBlockHeader.getGenStamp();
    Block block = new Block(blockId, 0, genStamp);

    if (!dataXceiverServer.balanceThrottler.acquire()) { // not able to start
      LOG.info("Not able to copy block " + blockId + " to " 
          + s.getRemoteSocketAddress() + " because threads quota is exceeded.");
      return;
    }

    BlockSender blockSender = null;
    DataOutputStream reply = null;
    boolean isOpSuccess = true;
    updateCurrentThreadName("Copying block " + block);
    try {
      // check if the block exists or not
      blockSender = new BlockSender(namespaceId, block, 0, -1, false, false, false,
          false,
          versionAndOpcode.getDataTransferVersion() >=
              DataTransferProtocol.PACKET_INCLUDE_VERSION_VERSION, true,
          datanode, null);

      // set up response stream
      OutputStream baseStream = NetUtils.getOutputStream(
          s, datanode.socketWriteTimeout);
      reply = new DataOutputStream(new BufferedOutputStream(
          baseStream, SMALL_BUFFER_SIZE));

      // send block content to the target
      long read = blockSender.sendBlock(reply, baseStream, 
                                        dataXceiverServer.balanceThrottler);

      long readDuration = System.currentTimeMillis() - startTime;
      datanode.myMetrics.bytesReadLatency.inc(readDuration);
      datanode.myMetrics.bytesRead.inc((int) read);
      if (read > KB_RIGHT_SHIFT_MIN) {
        datanode.myMetrics.bytesReadRate.inc((int) (read >> KB_RIGHT_SHIFT_BITS),
                          readDuration);
      }
      datanode.myMetrics.blocksRead.inc();
      
      LOG.info("Copied block " + block + " to " + s.getRemoteSocketAddress());
    } catch (IOException ioe) {
      isOpSuccess = false;
      throw ioe;
    } finally {
      dataXceiverServer.balanceThrottler.release();
      if (isOpSuccess) {
        try {
          // send one last byte to indicate that the resource is cleaned.
          reply.writeChar('d');
        } catch (IOException ignored) {
        }
      }
      IOUtils.closeStream(reply);
      IOUtils.closeStream(blockSender);
    }
  }
88781
public static float[] copyOfRange(final float[] original, final int from, final int to) {
        if (from == 0 && to == original.length) {
            return original.clone();
        }

        final int newLength = to - from;
        final float[] copy = new float[newLength];
        copy(original, from, copy, 0, Math.min(original.length - from, newLength));
        return copy;
    }
612787
public static void copyProperties(@Nullable Drawable to, @Nullable Drawable from) {
    if (from == null || to == null || to == from) {
      return;
    }

    to.setBounds(from.getBounds());
    to.setChangingConfigurations(from.getChangingConfigurations());
    to.setLevel(from.getLevel());
    to.setVisible(from.isVisible(), /* restart */ false);
    to.setState(from.getState());
  }
281746
public static <K, V> void putAll(Map<K, V> to, Map<? extends K, ? extends V> from) {
        if (to != null && from != null) {
            to.putAll(from);
        }
    }
945380
private @Nullable CodeBlock initialValue(Field field) {
    if (field.isPacked() || field.isRepeated()) {
      return CodeBlock.of("$T.newMutableList()", Internal.class);
    } else if (field.type().isMap()) {
      return CodeBlock.of("$T.newMutableMap()", Internal.class);
    } else {
      return null;
    }
  }
476256
@SuppressWarnings("unchecked")
public void copy(Copier from)
   {
      if(!(from instanceof Topic))
      {
         return;
      }
      
      Topic<T> topic = (Topic<T>)from;
      this.name = topic.name;
      this.observerMap = topic.observerMap;
   }
843178
public static Iterable<MBlockPos> getAllInBox(MBlockPos from, MBlockPos to)
	{
		return new BlockIterator(from, to).asIterable();
	}
874478
@Override
    public StreamT<W,T> slice(final long from, final long to) {

        return (StreamT<W,T>) FoldableTransformerSeq.super.slice(from, to);
    }
473729
public static void copyFromTo(Object from, Object to, String fieldName) {

        if (from == null || to == null) {
            log.info("object deep copy : from or to is null ");
            return;
        }

        try {
            Method getter = getGetterMethod(from.getClass(), fieldName);

            if (getter == null) {
                //log.info("getter method not found : " + fieldName);
                return;
            }

            Method setter = getSetterMethod(to.getClass(), fieldName, getter.getReturnType());
            if (setter == null) {
                //log.info("setter method not found : " + fieldName);
                return;
            }

            setter.invoke(to, getter.invoke(from, EMPTY_CLASS));

        } catch (IllegalAccessException | InvocationTargetException e) {
            log.info("set method invoke error : " + fieldName);
        }
    }
942569
@Override
    public Promise<Void> copy(String from, String to) {
        return adapter.toPromise(handler -> vertx.fileSystem().copy(from, to, handler));
    }
594214
public static <T> T[] shrink(T[] from, T[] to)
    {
        assert to.length <= from.length;
        System.arraycopy(from, 0, to, 0, to.length);
        return to;
    }
746445
private void clearElementArrays(final int from, final int to) {

        if (isIntKey) {
            int counter = to;

            while (--counter >= from) {
                intKeyTable[counter] = 0;
            }
        } else if (isLongKey) {
            int counter = to;

            while (--counter >= from) {
                longKeyTable[counter] = 0;
            }
        } else if (isObjectKey) {
            int counter = to;

            while (--counter >= from) {
                objectKeyTable[counter] = null;
            }
        }

        if (isIntValue) {
            int counter = to;

            while (--counter >= from) {
                intValueTable[counter] = 0;
            }
        } else if (isLongValue) {
            int counter = to;

            while (--counter >= from) {
                longValueTable[counter] = 0;
            }
        } else if (isObjectValue) {
            int counter = to;

            while (--counter >= from) {
                objectValueTable[counter] = null;
            }
        }

        if (accessTable != null) {
            int counter = to;

            while (--counter >= from) {
                accessTable[counter] = 0;
            }
        }

        if (multiValueTable != null) {
            int counter = to;

            while (--counter >= from) {
                multiValueTable[counter] = false;
            }
        }
    }
1085977
public static String[] copyOfRange(String[] old, int from, int to) {
    int length = to - from;
    String[] newArray = new String[length];
    int minLength = Math.min(old.length - from, length);
    System.arraycopy(old, from, newArray, 0, minLength);
    return newArray;
  }
1238485
public static <T> void copyFields(Class<T> type, T dest, T source) {
		Class<?> clazz = type;
		while (clazz != null && !Object.class.equals(clazz)) {
			for (final Field field : clazz.getDeclaredFields()) {
				if (!Modifier.isStatic(field.getModifiers())) {
					field.setAccessible(true);
					try {
						field.set(dest, field.get(source));
					} catch (IllegalArgumentException | IllegalAccessException e) {
						throw new Error(e);
					}
				}
			}
			clazz = clazz.getSuperclass();
		}
	}
747302
public static <T extends Comparable<? super T>> Predicates<T> betweenExclusive(T from, T to)
    {
        Predicates.failIfDifferentTypes(from, to);
        return new BetweenExclusive<T>(from, to);
    }