本文整理了Java中java.util.LinkedList.removeFirstOccurrence()
方法的一些代码示例,展示了LinkedList.removeFirstOccurrence()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LinkedList.removeFirstOccurrence()
方法的具体详情如下:
包路径:java.util.LinkedList
类名称:LinkedList
方法名:removeFirstOccurrence
[英]Removes the first occurrence of the specified element in this list (when traversing the list from head to tail). If the list does not contain the element, it is unchanged.
[中]删除此列表中指定元素的第一个匹配项(从头到尾遍历列表时)。如果列表不包含该元素,则该元素将保持不变。
代码示例来源:origin: spotbugs/spotbugs
@ExpectWarning("GC")
public void test() {
LinkedList<Integer> lst = new LinkedList<Integer>();
lst.add(1);
lst.add(2);
lst.add(3);
lst.removeFirstOccurrence("a");
lst.removeLastOccurrence("a");
Vector<Integer> v = new Vector<Integer>();
v.addAll(lst);
v.indexOf((long) 1, 1);
v.lastIndexOf((long) 1, 1);
}
代码示例来源:origin: org.apache.zookeeper/zookeeper
if (!p.bb.hasRemaining()) {
sentCount++;
outgoingQueue.removeFirstOccurrence(p);
if (p.requestHeader != null
&& p.requestHeader.getType() != OpCode.ping
代码示例来源:origin: com.jtransc/jtransc-rt
@Override
public boolean removeFirstOccurrence(Object o) {
return queue.removeFirstOccurrence(o);
}
代码示例来源:origin: com.daioware.collections/concurrent
@Override
public synchronized boolean removeFirstOccurrence(Object o) {
return super.removeFirstOccurrence(o);
}
代码示例来源:origin: com.virjar/dungproxy-client
@Override
public boolean removeFirstOccurrence(Object o) {
lock.lock();
try {
return super.removeFirstOccurrence(o);
} finally {
lock.unlock();
}
}
代码示例来源:origin: stackoverflow.com
import java.util.LinkedList;
class Sieve{
public static LinkedList<Long> sieve(long n){
if(n < 2) return new LinkedList<Long>();
LinkedList<Long> primes = new LinkedList<Long>();
LinkedList<Long> nums = new LinkedList<Long>();
for(long i = 2;i <= n;i++){ //unoptimized
nums.add(i);
}
while(nums.size() > 0){
long nextPrime = nums.remove();
for(long i = nextPrime * nextPrime;i <= n;i += nextPrime){
nums.removeFirstOccurrence(i);
}
primes.add(nextPrime);
}
return primes;
}
}
代码示例来源:origin: Johnnei/JavaTorrent
/**
* Adds the given element to the list.
* @param target The item to add if not present.
* @return The found element or <code>target</code> if absent.
*/
public E putIfAbsent(E target) {
for (E element : list) {
if (!element.equals(target)) {
continue;
}
list.removeFirstOccurrence(element);
list.addFirst(element);
return element;
}
add(target);
return target;
}
}
代码示例来源:origin: org.apache.openjpa/openjpa-all
@Override
public boolean removeFirstOccurrence(Object paramObject) {
if (_directAccess) {
return super.removeFirstOccurrence(paramObject);
}
if (isDelayLoad()) {
load();
}
Proxies.dirty(this, true);
return super.removeFirstOccurrence(paramObject);
}
代码示例来源:origin: org.apache.openejb.patch/openjpa
@Override
public boolean removeFirstOccurrence(Object paramObject) {
if (_directAccess) {
return super.removeFirstOccurrence(paramObject);
}
if (isDelayLoad()) {
load();
}
Proxies.dirty(this, true);
return super.removeFirstOccurrence(paramObject);
}
代码示例来源:origin: org.apache.openjpa/openjpa-kernel
@Override
public boolean removeFirstOccurrence(Object paramObject) {
if (_directAccess) {
return super.removeFirstOccurrence(paramObject);
}
if (isDelayLoad()) {
load();
}
Proxies.dirty(this, true);
return super.removeFirstOccurrence(paramObject);
}
代码示例来源:origin: org.apache.openejb.patch/openjpa-kernel
@Override
public boolean removeFirstOccurrence(Object paramObject) {
if (_directAccess) {
return super.removeFirstOccurrence(paramObject);
}
if (isDelayLoad()) {
load();
}
Proxies.dirty(this, true);
return super.removeFirstOccurrence(paramObject);
}
代码示例来源:origin: net.digitalid.utility/utility-collections
@Impure
@Override
@NonFrozenRecipient
public boolean removeFirstOccurrence(@NonCaptured @Unmodified @Nullable Object object) {
return super.removeFirstOccurrence(object);
}
代码示例来源:origin: williamfiset/data-structures
l1.removeFirstOccurrence(rand_val);
l2.removeFirstOccurrence(rand_val);
代码示例来源:origin: williamfiset/data-structures
l1.removeFirstOccurrence(rand_val);
l2.removeFirstOccurrence(rand_val);
代码示例来源:origin: williamfiset/data-structures
l1.removeFirstOccurrence(rand_val);
l2.removeFirstOccurrence(rand_val);
代码示例来源:origin: williamfiset/data-structures
l1.removeFirstOccurrence(randVal);
l2.removeFirstOccurrence(randVal);
内容来源于网络,如有侵权,请联系作者删除!