Tabnine Logo
ArrayList.clone
Code IndexAdd Tabnine to your IDE (free)

How to use
clone
method
in
java.util.ArrayList

Best Java code snippets using java.util.ArrayList.clone (Showing top 20 results out of 4,455)

Refine searchRefine arrow

  • ArrayList.get
  • ArrayList.size
  • ArrayList.add
origin: spotbugs/spotbugs

  public static int f(ArrayList list) {
    ArrayList workingList = (ArrayList) list.clone();
    Iterator iter = workingList != null ? workingList.iterator() : null;
    return workingList.size();
  }
}
origin: commons-collections/commons-collections

/**
 * Appends the specified element to the end of this list.
 *
 * @param element The element to be appended
 */
public boolean add(Object element) {
  if (fast) {
    synchronized (this) {
      ArrayList temp = (ArrayList) list.clone();
      boolean result = temp.add(element);
      list = temp;
      return (result);
    }
  } else {
    synchronized (list) {
      return (list.add(element));
    }
  }
}
origin: lingochamp/okdownload

public long getTotalOffset() {
  long offset = 0;
  ArrayList<BlockInfo> list = (ArrayList<BlockInfo>) ((ArrayList) blockInfoList).clone();
  final int count = list.size();
  for (int i = 0; i < count; i++) {
    final BlockInfo info = list.get(i);
    offset += info.getCurrentOffset();
  }
  return offset;
}
origin: commonsguy/cw-omnibus

/**
 * Called internally to start an animation by adding it to the active animations list. Must be
 * called on the UI thread.
 */
private void startAnimation() {
  initAnimation();
  sAnimations.get().add(this);
  if (mStartDelay > 0 && mListeners != null) {
    // Listeners were already notified in start() if startDelay is 0; this is
    // just for delayed animations
    ArrayList<AnimatorListener> tmpListeners =
        (ArrayList<AnimatorListener>) mListeners.clone();
    int numListeners = tmpListeners.size();
    for (int i = 0; i < numListeners; ++i) {
      tmpListeners.get(i).onAnimationStart(this);
    }
  }
}
origin: cmusphinx/sphinx4

    Path cur = paths.get(s);
    p.setCost(cur.getCost());
    p.setPath((ArrayList<String>) cur.getPath().clone());
      String phone = symsArray[i];
      if (!skipSeqs.contains(phone)) {
        p.getPath().add(phone);
  res.add(path);
int numPaths = res.size();
for (int i = nbest; i < numPaths; i++) {
  res.remove(res.size() - 1);
origin: com.thoughtworks.xstream/xstream

&& parameterTypes.length + k - j <= typedDependencies.length; k++) {
if (parameterTypes[j].isAssignableFrom(typedDependencies[k].type)) {
  matchingDependencies.add(typedDependencies[k].value);
  usedDeps |= 1L << k;
  if (++j == parameterTypes.length) {
    matchingDependencies.add(deps[assignable].value);
    usedDeps |= 1L << assignable;
  possibleMatchingDependencies = (List)matchingDependencies.clone();
  possibleUsedDeps = usedDeps;
origin: stackoverflow.com

 String[] array = new String[10];
array[0] = "111";
ArrayList one = new ArrayList(); 
one.add(array);
ArrayList two = (ArrayList) one.clone(); //Alternate with: ArrayList two = one;
String[] stringarray1 = (String[]) one.get(0);
String[] stringarray2 = (String[]) two.get(0);
System.out.println("Array: "+one+" with value: "+stringarray1[0]);
System.out.println("Array: "+one+" with value: "+stringarray2[0]);
array[0] = "999";
String[] stringarray3 = (String[]) one.get(0);
String[] stringarray4 = (String[]) two.get(0);
System.out.println("Array: "+one+" with value: "+stringarray3[0]);
System.out.println("Array: "+two+" with value: "+stringarray4[0]);
origin: commonsguy/cw-omnibus

if (animations.size() > 0 || delayedAnims.size() > 0) {
  callAgain = false;
while (pendingAnimations.size() > 0) {
  ArrayList<ValueAnimator> pendingCopy =
      (ArrayList<ValueAnimator>) pendingAnimations.clone();
  pendingAnimations.clear();
  int count = pendingCopy.size();
  for (int i = 0; i < count; ++i) {
    ValueAnimator anim = pendingCopy.get(i);
      delayedAnims.add(anim);
int numDelayedAnims = delayedAnims.size();
for (int i = 0; i < numDelayedAnims; ++i) {
  ValueAnimator anim = delayedAnims.get(i);
  if (anim.delayedAnimationFrame(currentTime)) {
    readyAnims.add(anim);
  ValueAnimator anim = animations.get(i);
  if (anim.animationFrame(currentTime)) {
    endingAnims.add(anim);
  if (animations.size() == numAnims) {
origin: commonsguy/cw-omnibus

/**
 * Called internally to end an animation by removing it from the animations list. Must be
 * called on the UI thread.
 */
private void endAnimation() {
  sAnimations.get().remove(this);
  sPendingAnimations.get().remove(this);
  sDelayedAnims.get().remove(this);
  mPlayingState = STOPPED;
  if (mRunning && mListeners != null) {
    ArrayList<AnimatorListener> tmpListeners =
        (ArrayList<AnimatorListener>) mListeners.clone();
    int numListeners = tmpListeners.size();
    for (int i = 0; i < numListeners; ++i) {
      tmpListeners.get(i).onAnimationEnd(this);
    }
  }
  mRunning = false;
  mStarted = false;
}
origin: ch.unibas.cs.gravis/scalismo-native-stub

@Override
public final void addKeyListener(int index, final KeyListener l) {
  if(l == null) {
    return;
  }
  @SuppressWarnings("unchecked")
  final
  ArrayList<KeyListener> clonedListeners = (ArrayList<KeyListener>) keyListeners.clone();
  if(0>index) {
    index = clonedListeners.size();
  }
  clonedListeners.add(index, l);
  keyListeners = clonedListeners;
}
origin: commons-collections/commons-collections

/**
 * Insert the specified element at the specified position in this list,
 * and shift all remaining elements up one position.
 *
 * @param index Index at which to insert this element
 * @param element The element to be inserted
 *
 * @exception IndexOutOfBoundsException if the index is out of range
 */
public void add(int index, Object element) {
  if (fast) {
    synchronized (this) {
      ArrayList temp = (ArrayList) list.clone();
      temp.add(index, element);
      list = temp;
    }
  } else {
    synchronized (list) {
      list.add(index, element);
    }
  }
}
origin: commonsguy/cw-omnibus

mTerminated = true;
if (isStarted()) {
  if (mSortedNodes.size() != mNodes.size()) {
    mDelayAnim.cancel();
  if (mSortedNodes.size() > 0) {
    for (Node node : mSortedNodes) {
      node.animation.end();
        (ArrayList<AnimatorListener>) mListeners.clone();
    for (AnimatorListener listener : tmpListeners) {
      listener.onAnimationEnd(this);
origin: commonsguy/cw-omnibus

mStarted = true;
mStartedDelay = false;
sPendingAnimations.get().add(this);
if (mStartDelay == 0) {
        (ArrayList<AnimatorListener>) mListeners.clone();
    int numListeners = tmpListeners.size();
    for (int i = 0; i < numListeners; ++i) {
      tmpListeners.get(i).onAnimationStart(this);
origin: andkulikov/Transitions-Everywhere

/**
 * This method is called automatically by the transition and
 * TransitionSet classes prior to a Transition subclass starting;
 * subclasses should not need to call it directly.
 *
 * @hide
 */
protected void start() {
  if (mNumInstances == 0) {
    if (mListeners != null && mListeners.size() > 0) {
      ArrayList<TransitionListener> tmpListeners =
          (ArrayList<TransitionListener>) mListeners.clone();
      int numListeners = tmpListeners.size();
      for (int i = 0; i < numListeners; ++i) {
        tmpListeners.get(i).onTransitionStart(this);
      }
    }
    mEnded = false;
  }
  mNumInstances++;
}
origin: org.jogamp.jogl/jogl-all-noawt

@Override
public final void addKeyListener(int index, final KeyListener l) {
  if(l == null) {
    return;
  }
  @SuppressWarnings("unchecked")
  final
  ArrayList<KeyListener> clonedListeners = (ArrayList<KeyListener>) keyListeners.clone();
  if(0>index) {
    index = clonedListeners.size();
  }
  clonedListeners.add(index, l);
  keyListeners = clonedListeners;
}
origin: wildfly/wildfly

/**
 * Appends the specified element to the end of this list.
 *
 * @param element The element to be appended
 */
public boolean add(Object element) {
  if (fast) {
    synchronized (this) {
      ArrayList temp = (ArrayList) list.clone();
      boolean result = temp.add(element);
      list = temp;
      return (result);
    }
  } else {
    synchronized (list) {
      return (list.add(element));
    }
  }
}
origin: commonsguy/cw-omnibus

ArrayList<AnimatorListener> tmpListeners = null;
if (mListeners != null) {
  tmpListeners = (ArrayList<AnimatorListener>) mListeners.clone();
  for (AnimatorListener listener : tmpListeners) {
    listener.onAnimationCancel(this);
} else  if (mSortedNodes.size() > 0) {
  for (Node node : mSortedNodes) {
    node.animation.cancel();
origin: commonsguy/cw-omnibus

int numSortedNodes = mSortedNodes.size();
for (int i = 0; i < numSortedNodes; ++i) {
  Node node = mSortedNodes.get(i);
  if (oldListeners != null && oldListeners.size() > 0) {
    final ArrayList<AnimatorListener> clonedListeners = new
        ArrayList<AnimatorListener>(oldListeners);
  Node node = mSortedNodes.get(i);
  if (mSetListener == null) {
    mSetListener = new AnimatorSetListener(this);
    node.tmpDependencies = (ArrayList<Dependency>) node.dependencies.clone();
  for (Node node : nodesToStart) {
    node.animation.start();
    mPlayingSet.add(node.animation);
      (ArrayList<AnimatorListener>) mListeners.clone();
  int numListeners = tmpListeners.size();
  for (int i = 0; i < numListeners; ++i) {
  if (mListeners != null) {
    ArrayList<AnimatorListener> tmpListeners =
        (ArrayList<AnimatorListener>) mListeners.clone();
    int numListeners = tmpListeners.size();
    for (int i = 0; i < numListeners; ++i) {
origin: andkulikov/Transitions-Everywhere

/**
 * This method cancels a transition that is currently running.
 *
 * @hide
 */
protected void cancel() {
  int numAnimators = mCurrentAnimators.size();
  for (int i = numAnimators - 1; i >= 0; i--) {
    Animator animator = mCurrentAnimators.get(i);
    animator.cancel();
  }
  if (mListeners != null && mListeners.size() > 0) {
    ArrayList<TransitionListener> tmpListeners =
        (ArrayList<TransitionListener>) mListeners.clone();
    int numListeners = tmpListeners.size();
    for (int i = 0; i < numListeners; ++i) {
      tmpListeners.get(i).onTransitionCancel(this);
    }
  }
}
origin: ch.unibas.cs.gravis/scalismo-native-stub

@Override
public final void addMouseListener(int index, final MouseListener l) {
  if(l == null) {
    return;
  }
  @SuppressWarnings("unchecked")
  final
  ArrayList<MouseListener> clonedListeners = (ArrayList<MouseListener>) mouseListeners.clone();
  if(0>index) {
    index = clonedListeners.size();
  }
  clonedListeners.add(index, l);
  mouseListeners = clonedListeners;
}
java.utilArrayListclone

Javadoc

Returns a new ArrayList with the same elements, the same size and the same capacity as this ArrayList.

Popular methods of ArrayList

  • <init>
  • add
  • size
    Returns the number of elements in this ArrayList.
  • get
    Returns the element at the specified position in this list.
  • toArray
    Returns an array containing all of the elements in this list in proper sequence (from first to last
  • addAll
    Adds the objects in the specified collection to this ArrayList.
  • remove
    Removes the first occurrence of the specified element from this list, if it is present. If the list
  • clear
    Removes all elements from this ArrayList, leaving it empty.
  • isEmpty
    Returns true if this list contains no elements.
  • iterator
    Returns an iterator over the elements in this list in proper sequence.The returned iterator is fail-
  • contains
    Searches this ArrayList for the specified object.
  • set
    Replaces the element at the specified position in this list with the specified element.
  • contains,
  • set,
  • indexOf,
  • subList,
  • stream,
  • ensureCapacity,
  • trimToSize,
  • removeAll,
  • toString

Popular in Java

  • Start an intent from android
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getExternalFilesDir (Context)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now