java.util.ArrayDeque.delete()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(16.1k)|赞(0)|评价(0)|浏览(178)

本文整理了Java中java.util.ArrayDeque.delete()方法的一些代码示例,展示了ArrayDeque.delete()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ArrayDeque.delete()方法的具体详情如下:
包路径:java.util.ArrayDeque
类名称:ArrayDeque
方法名:delete

ArrayDeque.delete介绍

[英]Removes the element at the specified position in the elements array, adjusting head and tail as necessary. This can result in motion of elements backwards or forwards in the array.

This method is called delete rather than remove to emphasize that its semantics differ from those of List#remove(int).
[中]在元素数组中的指定位置删除元素,并根据需要调整头部和尾部。这可能导致元素在数组中前后移动。
此方法称为delete而不是remove,以强调其语义不同于List#remove(int)的语义。

代码示例

代码示例来源:origin: robovm/robovm

/**
 * Removes the first occurrence of the specified element in this
 * deque (when traversing the deque from head to tail).
 * If the deque does not contain the element, it is unchanged.
 * More formally, removes the first element <tt>e</tt> such that
 * <tt>o.equals(e)</tt> (if such an element exists).
 * Returns <tt>true</tt> if this deque contained the specified element
 * (or equivalently, if this deque changed as a result of the call).
 *
 * @param o element to be removed from this deque, if present
 * @return <tt>true</tt> if the deque contained the specified element
 */
public boolean removeFirstOccurrence(Object o) {
  if (o == null)
    return false;
  int mask = elements.length - 1;
  int i = head;
  Object x;
  while ( (x = elements[i]) != null) {
    if (o.equals(x)) {
      delete(i);
      return true;
    }
    i = (i + 1) & mask;
  }
  return false;
}

代码示例来源:origin: robovm/robovm

/**
 * Removes the last occurrence of the specified element in this
 * deque (when traversing the deque from head to tail).
 * If the deque does not contain the element, it is unchanged.
 * More formally, removes the last element <tt>e</tt> such that
 * <tt>o.equals(e)</tt> (if such an element exists).
 * Returns <tt>true</tt> if this deque contained the specified element
 * (or equivalently, if this deque changed as a result of the call).
 *
 * @param o element to be removed from this deque, if present
 * @return <tt>true</tt> if the deque contained the specified element
 */
public boolean removeLastOccurrence(Object o) {
  if (o == null)
    return false;
  int mask = elements.length - 1;
  int i = (tail - 1) & mask;
  Object x;
  while ( (x = elements[i]) != null) {
    if (o.equals(x)) {
      delete(i);
      return true;
    }
    i = (i - 1) & mask;
  }
  return false;
}

代码示例来源:origin: ibinti/bugvm

/**
 * Removes the first occurrence of the specified element in this
 * deque (when traversing the deque from head to tail).
 * If the deque does not contain the element, it is unchanged.
 * More formally, removes the first element <tt>e</tt> such that
 * <tt>o.equals(e)</tt> (if such an element exists).
 * Returns <tt>true</tt> if this deque contained the specified element
 * (or equivalently, if this deque changed as a result of the call).
 *
 * @param o element to be removed from this deque, if present
 * @return <tt>true</tt> if the deque contained the specified element
 */
public boolean removeFirstOccurrence(Object o) {
  if (o == null)
    return false;
  int mask = elements.length - 1;
  int i = head;
  Object x;
  while ( (x = elements[i]) != null) {
    if (o.equals(x)) {
      delete(i);
      return true;
    }
    i = (i + 1) & mask;
  }
  return false;
}

代码示例来源:origin: MobiVM/robovm

/**
 * Removes the first occurrence of the specified element in this
 * deque (when traversing the deque from head to tail).
 * If the deque does not contain the element, it is unchanged.
 * More formally, removes the first element <tt>e</tt> such that
 * <tt>o.equals(e)</tt> (if such an element exists).
 * Returns <tt>true</tt> if this deque contained the specified element
 * (or equivalently, if this deque changed as a result of the call).
 *
 * @param o element to be removed from this deque, if present
 * @return <tt>true</tt> if the deque contained the specified element
 */
public boolean removeFirstOccurrence(Object o) {
  if (o == null)
    return false;
  int mask = elements.length - 1;
  int i = head;
  Object x;
  while ( (x = elements[i]) != null) {
    if (o.equals(x)) {
      delete(i);
      return true;
    }
    i = (i + 1) & mask;
  }
  return false;
}

代码示例来源:origin: com.jtransc/jtransc-rt

/**
 * Removes the first occurrence of the specified element in this
 * deque (when traversing the deque from head to tail).
 * If the deque does not contain the element, it is unchanged.
 * More formally, removes the first element <tt>e</tt> such that
 * <tt>o.equals(e)</tt> (if such an element exists).
 * Returns <tt>true</tt> if this deque contained the specified element
 * (or equivalently, if this deque changed as a result of the call).
 *
 * @param o element to be removed from this deque, if present
 * @return <tt>true</tt> if the deque contained the specified element
 */
public boolean removeFirstOccurrence(Object o) {
  if (o == null)
    return false;
  int mask = elements.length - 1;
  int i = head;
  Object x;
  while ( (x = elements[i]) != null) {
    if (o.equals(x)) {
      delete(i);
      return true;
    }
    i = (i + 1) & mask;
  }
  return false;
}

代码示例来源:origin: org.codehaus.jsr166-mirror/jsr166

/**
 * Removes the first occurrence of the specified element in this
 * deque (when traversing the deque from head to tail).
 * If the deque does not contain the element, it is unchanged.
 * More formally, removes the first element <tt>e</tt> such that
 * <tt>o.equals(e)</tt> (if such an element exists).
 * Returns <tt>true</tt> if this deque contained the specified element
 * (or equivalently, if this deque changed as a result of the call).
 *
 * @param o element to be removed from this deque, if present
 * @return <tt>true</tt> if the deque contained the specified element
 */
public boolean removeFirstOccurrence(Object o) {
  if (o == null)
    return false;
  int mask = elements.length - 1;
  int i = head;
  E x;
  while ( (x = elements[i]) != null) {
    if (o.equals(x)) {
      delete(i);
      return true;
    }
    i = (i + 1) & mask;
  }
  return false;
}

代码示例来源:origin: com.gluonhq/robovm-rt

/**
 * Removes the first occurrence of the specified element in this
 * deque (when traversing the deque from head to tail).
 * If the deque does not contain the element, it is unchanged.
 * More formally, removes the first element <tt>e</tt> such that
 * <tt>o.equals(e)</tt> (if such an element exists).
 * Returns <tt>true</tt> if this deque contained the specified element
 * (or equivalently, if this deque changed as a result of the call).
 *
 * @param o element to be removed from this deque, if present
 * @return <tt>true</tt> if the deque contained the specified element
 */
public boolean removeFirstOccurrence(Object o) {
  if (o == null)
    return false;
  int mask = elements.length - 1;
  int i = head;
  Object x;
  while ( (x = elements[i]) != null) {
    if (o.equals(x)) {
      delete(i);
      return true;
    }
    i = (i + 1) & mask;
  }
  return false;
}

代码示例来源:origin: MobiVM/robovm

/**
 * Removes the last occurrence of the specified element in this
 * deque (when traversing the deque from head to tail).
 * If the deque does not contain the element, it is unchanged.
 * More formally, removes the last element <tt>e</tt> such that
 * <tt>o.equals(e)</tt> (if such an element exists).
 * Returns <tt>true</tt> if this deque contained the specified element
 * (or equivalently, if this deque changed as a result of the call).
 *
 * @param o element to be removed from this deque, if present
 * @return <tt>true</tt> if the deque contained the specified element
 */
public boolean removeLastOccurrence(Object o) {
  if (o == null)
    return false;
  int mask = elements.length - 1;
  int i = (tail - 1) & mask;
  Object x;
  while ( (x = elements[i]) != null) {
    if (o.equals(x)) {
      delete(i);
      return true;
    }
    i = (i - 1) & mask;
  }
  return false;
}

代码示例来源:origin: ibinti/bugvm

/**
 * Removes the last occurrence of the specified element in this
 * deque (when traversing the deque from head to tail).
 * If the deque does not contain the element, it is unchanged.
 * More formally, removes the last element <tt>e</tt> such that
 * <tt>o.equals(e)</tt> (if such an element exists).
 * Returns <tt>true</tt> if this deque contained the specified element
 * (or equivalently, if this deque changed as a result of the call).
 *
 * @param o element to be removed from this deque, if present
 * @return <tt>true</tt> if the deque contained the specified element
 */
public boolean removeLastOccurrence(Object o) {
  if (o == null)
    return false;
  int mask = elements.length - 1;
  int i = (tail - 1) & mask;
  Object x;
  while ( (x = elements[i]) != null) {
    if (o.equals(x)) {
      delete(i);
      return true;
    }
    i = (i - 1) & mask;
  }
  return false;
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * Removes the first occurrence of the specified element in this
 * deque (when traversing the deque from head to tail).
 * If the deque does not contain the element, it is unchanged.
 * More formally, removes the first element <tt>e</tt> such that
 * <tt>o.equals(e)</tt> (if such an element exists).
 * Returns <tt>true</tt> if this deque contained the specified element
 * (or equivalently, if this deque changed as a result of the call).
 *
 * @param o element to be removed from this deque, if present
 * @return <tt>true</tt> if the deque contained the specified element
 */
public boolean removeFirstOccurrence(Object o) {
  if (o == null)
    return false;
  int mask = elements.length - 1;
  int i = head;
  Object x;
  while ( (x = elements[i]) != null) {
    if (o.equals(x)) {
      delete(i);
      return true;
    }
    i = (i + 1) & mask;
  }
  return false;
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * Removes the last occurrence of the specified element in this
 * deque (when traversing the deque from head to tail).
 * If the deque does not contain the element, it is unchanged.
 * More formally, removes the last element <tt>e</tt> such that
 * <tt>o.equals(e)</tt> (if such an element exists).
 * Returns <tt>true</tt> if this deque contained the specified element
 * (or equivalently, if this deque changed as a result of the call).
 *
 * @param o element to be removed from this deque, if present
 * @return <tt>true</tt> if the deque contained the specified element
 */
public boolean removeLastOccurrence(Object o) {
  if (o == null)
    return false;
  int mask = elements.length - 1;
  int i = (tail - 1) & mask;
  Object x;
  while ( (x = elements[i]) != null) {
    if (o.equals(x)) {
      delete(i);
      return true;
    }
    i = (i - 1) & mask;
  }
  return false;
}

代码示例来源:origin: org.apidesign.bck2brwsr/emul

/**
 * Removes the last occurrence of the specified element in this
 * deque (when traversing the deque from head to tail).
 * If the deque does not contain the element, it is unchanged.
 * More formally, removes the last element <tt>e</tt> such that
 * <tt>o.equals(e)</tt> (if such an element exists).
 * Returns <tt>true</tt> if this deque contained the specified element
 * (or equivalently, if this deque changed as a result of the call).
 *
 * @param o element to be removed from this deque, if present
 * @return <tt>true</tt> if the deque contained the specified element
 */
public boolean removeLastOccurrence(Object o) {
  if (o == null)
    return false;
  int mask = elements.length - 1;
  int i = (tail - 1) & mask;
  E x;
  while ( (x = elements[i]) != null) {
    if (o.equals(x)) {
      delete(i);
      return true;
    }
    i = (i - 1) & mask;
  }
  return false;
}

代码示例来源:origin: org.apidesign.bck2brwsr/emul

/**
 * Removes the first occurrence of the specified element in this
 * deque (when traversing the deque from head to tail).
 * If the deque does not contain the element, it is unchanged.
 * More formally, removes the first element <tt>e</tt> such that
 * <tt>o.equals(e)</tt> (if such an element exists).
 * Returns <tt>true</tt> if this deque contained the specified element
 * (or equivalently, if this deque changed as a result of the call).
 *
 * @param o element to be removed from this deque, if present
 * @return <tt>true</tt> if the deque contained the specified element
 */
public boolean removeFirstOccurrence(Object o) {
  if (o == null)
    return false;
  int mask = elements.length - 1;
  int i = head;
  E x;
  while ( (x = elements[i]) != null) {
    if (o.equals(x)) {
      delete(i);
      return true;
    }
    i = (i + 1) & mask;
  }
  return false;
}

代码示例来源:origin: org.codehaus.jsr166-mirror/jsr166

/**
 * Removes the last occurrence of the specified element in this
 * deque (when traversing the deque from head to tail).
 * If the deque does not contain the element, it is unchanged.
 * More formally, removes the last element <tt>e</tt> such that
 * <tt>o.equals(e)</tt> (if such an element exists).
 * Returns <tt>true</tt> if this deque contained the specified element
 * (or equivalently, if this deque changed as a result of the call).
 *
 * @param o element to be removed from this deque, if present
 * @return <tt>true</tt> if the deque contained the specified element
 */
public boolean removeLastOccurrence(Object o) {
  if (o == null)
    return false;
  int mask = elements.length - 1;
  int i = (tail - 1) & mask;
  E x;
  while ( (x = elements[i]) != null) {
    if (o.equals(x)) {
      delete(i);
      return true;
    }
    i = (i - 1) & mask;
  }
  return false;
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * Removes the last occurrence of the specified element in this
 * deque (when traversing the deque from head to tail).
 * If the deque does not contain the element, it is unchanged.
 * More formally, removes the last element <tt>e</tt> such that
 * <tt>o.equals(e)</tt> (if such an element exists).
 * Returns <tt>true</tt> if this deque contained the specified element
 * (or equivalently, if this deque changed as a result of the call).
 *
 * @param o element to be removed from this deque, if present
 * @return <tt>true</tt> if the deque contained the specified element
 */
public boolean removeLastOccurrence(Object o) {
  if (o == null)
    return false;
  int mask = elements.length - 1;
  int i = (tail - 1) & mask;
  Object x;
  while ( (x = elements[i]) != null) {
    if (o.equals(x)) {
      delete(i);
      return true;
    }
    i = (i - 1) & mask;
  }
  return false;
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * Removes the first occurrence of the specified element in this
 * deque (when traversing the deque from head to tail).
 * If the deque does not contain the element, it is unchanged.
 * More formally, removes the first element <tt>e</tt> such that
 * <tt>o.equals(e)</tt> (if such an element exists).
 * Returns <tt>true</tt> if this deque contained the specified element
 * (or equivalently, if this deque changed as a result of the call).
 *
 * @param o element to be removed from this deque, if present
 * @return <tt>true</tt> if the deque contained the specified element
 */
public boolean removeFirstOccurrence(Object o) {
  if (o == null)
    return false;
  int mask = elements.length - 1;
  int i = head;
  Object x;
  while ( (x = elements[i]) != null) {
    if (o.equals(x)) {
      delete(i);
      return true;
    }
    i = (i + 1) & mask;
  }
  return false;
}

代码示例来源:origin: com.jtransc/jtransc-rt

/**
 * Removes the last occurrence of the specified element in this
 * deque (when traversing the deque from head to tail).
 * If the deque does not contain the element, it is unchanged.
 * More formally, removes the last element <tt>e</tt> such that
 * <tt>o.equals(e)</tt> (if such an element exists).
 * Returns <tt>true</tt> if this deque contained the specified element
 * (or equivalently, if this deque changed as a result of the call).
 *
 * @param o element to be removed from this deque, if present
 * @return <tt>true</tt> if the deque contained the specified element
 */
public boolean removeLastOccurrence(Object o) {
  if (o == null)
    return false;
  int mask = elements.length - 1;
  int i = (tail - 1) & mask;
  Object x;
  while ( (x = elements[i]) != null) {
    if (o.equals(x)) {
      delete(i);
      return true;
    }
    i = (i - 1) & mask;
  }
  return false;
}

代码示例来源:origin: com.gluonhq/robovm-rt

/**
 * Removes the last occurrence of the specified element in this
 * deque (when traversing the deque from head to tail).
 * If the deque does not contain the element, it is unchanged.
 * More formally, removes the last element <tt>e</tt> such that
 * <tt>o.equals(e)</tt> (if such an element exists).
 * Returns <tt>true</tt> if this deque contained the specified element
 * (or equivalently, if this deque changed as a result of the call).
 *
 * @param o element to be removed from this deque, if present
 * @return <tt>true</tt> if the deque contained the specified element
 */
public boolean removeLastOccurrence(Object o) {
  if (o == null)
    return false;
  int mask = elements.length - 1;
  int i = (tail - 1) & mask;
  Object x;
  while ( (x = elements[i]) != null) {
    if (o.equals(x)) {
      delete(i);
      return true;
    }
    i = (i - 1) & mask;
  }
  return false;
}

代码示例来源:origin: FlexoVM/flexovm

/**
 * Removes the last occurrence of the specified element in this
 * deque (when traversing the deque from head to tail).
 * If the deque does not contain the element, it is unchanged.
 * More formally, removes the last element <tt>e</tt> such that
 * <tt>o.equals(e)</tt> (if such an element exists).
 * Returns <tt>true</tt> if this deque contained the specified element
 * (or equivalently, if this deque changed as a result of the call).
 *
 * @param o element to be removed from this deque, if present
 * @return <tt>true</tt> if the deque contained the specified element
 */
public boolean removeLastOccurrence(Object o) {
  if (o == null)
    return false;
  int mask = elements.length - 1;
  int i = (tail - 1) & mask;
  Object x;
  while ( (x = elements[i]) != null) {
    if (o.equals(x)) {
      delete(i);
      return true;
    }
    i = (i - 1) & mask;
  }
  return false;
}

代码示例来源:origin: jtulach/bck2brwsr

/**
 * Removes the last occurrence of the specified element in this
 * deque (when traversing the deque from head to tail).
 * If the deque does not contain the element, it is unchanged.
 * More formally, removes the last element <tt>e</tt> such that
 * <tt>o.equals(e)</tt> (if such an element exists).
 * Returns <tt>true</tt> if this deque contained the specified element
 * (or equivalently, if this deque changed as a result of the call).
 *
 * @param o element to be removed from this deque, if present
 * @return <tt>true</tt> if the deque contained the specified element
 */
public boolean removeLastOccurrence(Object o) {
  if (o == null)
    return false;
  int mask = elements.length - 1;
  int i = (tail - 1) & mask;
  E x;
  while ( (x = elements[i]) != null) {
    if (o.equals(x)) {
      delete(i);
      return true;
    }
    i = (i - 1) & mask;
  }
  return false;
}

相关文章