本文整理了Java中java.util.LinkedList.contains()
方法的一些代码示例,展示了LinkedList.contains()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LinkedList.contains()
方法的具体详情如下:
包路径:java.util.LinkedList
类名称:LinkedList
方法名:contains
[英]Returns true if this list contains the specified element. More formally, returns true if and only if this list contains at least one element e such that (o==null ? e==null : o.equals(e)).
[中]如果此列表包含指定的元素,则返回true。更正式地说,当且仅当此列表包含至少一个元素e时(o==null?e==null:o.equals(e))返回true。
代码示例来源:origin: cSploit/android
public static void registerSettingListener(SettingReceiver receiver) {
if (mSettingReceivers != null) {
synchronized (mSettingReceivers) {
if (!mSettingReceivers.contains(receiver)) {
mSettingReceivers.add(receiver);
}
}
}
}
代码示例来源:origin: marytts/marytts
if (!seenTypes.contains(outputType)) {
seenTypes.add(outputType);
logger.debug("Module " + candidate.name() + " converts " + sourceType.name() + " into " + outputType
+ " (locale " + locale + ", voice " + voice + ")");
代码示例来源:origin: com.vaadin/vaadin-server
if (components.contains(component)) {
throw new IllegalArgumentException(
"Component is already in the container");
if ((existingArea.row1 >= row1 && existingArea.column1 > column1)
|| existingArea.row1 > row1) {
components.add(index, component);
done = true;
break;
代码示例来源:origin: kilim/kilim
public void addSuper(String superName) {
if (superName.equals("java/lang/Object")) return;
if (!superClasses.contains(superName)) {superClasses.add(superName);}
}
public int getPausableStatus(String methodName, String desc) {
代码示例来源:origin: marytts/marytts
if (!seenTypes.contains(outputType)) {
seenTypes.add(outputType);
logger.debug("Module " + candidate.name() + " converts " + sourceType.name() + " into " + outputType
+ " (locale " + locale + ", voice " + voice + ")");
代码示例来源:origin: robovm/robovm
@Override
public boolean add(E o) {
if (!c.isAssignableFrom(o.getClass())) {
throw new IllegalArgumentException("Invalid type: " + o.getClass());
}
if (elements.contains(o)) {
return false;
}
elements.add(o);
return true;
}
代码示例来源:origin: geotools/geotools
Configuration c = (Configuration) stack.pop();
if (!unpacked.contains(c)) {
unpacked.addFirst(c);
stack.addAll(c.getDependencies());
unpacked.add(n.config);
for (DepNode i : n.incoming()) {
g.removeEdge(i.config, n.config);
代码示例来源:origin: Atmosphere/atmosphere
/**
* Add an {@link AsyncIOInterceptor} that will be invoked at the specified index position.
*
* @param filter {@link AsyncIOInterceptor
* @param index
* @return this
*/
public AtmosphereInterceptorWriter interceptor(AsyncIOInterceptor filter, int index) {
if (!filters.contains(filter)) {
if (logger.isTraceEnabled()) {
logger.trace("Adding AsyncIOInterceptor {} at index {}", filter.getClass().getName(), index);
}
filters.add(index, filter);
reversedFilters.add(reversedFilters.size() - index, filter);
}
return this;
}
代码示例来源:origin: robovm/robovm
protected SecureSet(AuthPermission perm, Collection<? extends SST> s) {
this(perm);
// Subject's constructor receives a Set, we can trusts if a set is from bootclasspath,
// and not to check whether it contains duplicates or not
boolean trust = s.getClass().getClassLoader() == null;
for (SST o : s) {
verifyElement(o);
if (trust || !elements.contains(o)) {
elements.add(o);
}
}
}
代码示例来源:origin: robovm/robovm
@Override
public boolean add(SST o) {
verifyElement(o);
checkState();
if (!elements.contains(o)) {
elements.add(o);
return true;
}
return false;
}
代码示例来源:origin: pentaho/pentaho-kettle
public org.pentaho.di.engine.model.Hop createHop( Operation from, Operation to, String type ) {
Preconditions.checkArgument( operations.contains( from ), "!operations.contains(from)" );
Preconditions.checkArgument( operations.contains( to ), "!operations.contains(to)" );
Preconditions.checkArgument( from != to, "from == to" );
org.pentaho.di.engine.model.Hop hop = new org.pentaho.di.engine.model.Hop( from, to, type );
Preconditions.checkState( hops.stream().noneMatch( it -> it.getFrom() == from && it.getTo() == to ),
"Hop from %s to %s already exists", from, to );
hops.add( hop );
return hop;
}
代码示例来源:origin: Sable/soot
public void setup_Graph(HashMap<AugmentedStmt, SwitchNode> binding) {
Iterator rit = ((AugmentedStmt) as.bsuccs.get(0)).get_Reachers().iterator();
while (rit.hasNext()) {
SwitchNode pred = binding.get(rit.next());
if (pred != null) {
if (preds.contains(pred) == false) {
preds.add(pred);
}
if (pred.succs.contains(this) == false) {
pred.succs.add(this);
}
}
}
}
代码示例来源:origin: Sable/soot
if (preds.contains(po) == false) {
preds.add(po);
if (succs.contains(so) == false) {
succs.add(so);
代码示例来源:origin: cSploit/android
if(!tcp.contains(pNumber))
tcp.add(pNumber);
} else if(protocol.equals(Network.Protocol.UDP)) {
if(!udp.contains(pNumber))
udp.add(pNumber);
代码示例来源:origin: wiztools/rest-client
public void push() {
final String item = (String) getSelectedItem();
final int count = getItemCount();
final LinkedList<String> l = new LinkedList<>();
for(int i=0; i<count; i++){
l.add(getItemAt(i));
}
if(l.contains(item)){ // Item already present
// Remove and add to bring it to the top
removeItem(item);
insertItemAt(item, 0);
}
else{ // Add new item
if(item.trim().length() != 0 ) {
// The total number of items should not exceed 20
if(count >= URL_COUNT_SIZE){
// Remove last item to give place
// to new one
removeItemAt(count - 1);
}
//l.addFirst(item);
insertItemAt(item, 0);
}
}
// make the selected item is the item we want
setSelectedItem(item);
}
}
代码示例来源:origin: org.apache.hadoop/hadoop-common
return;
toAdd.add(entry);
kick();
while (true) {
processedCond.awaitUninterruptibly();
if (!toAdd.contains(entry)) {
break;
代码示例来源:origin: Ramotion/cardslider-android
final boolean isRemoved = ((RecyclerView.LayoutParams)child.getLayoutParams()).isItemRemoved();
if (isRemoved) {
removed.add(getPosition(child));
if (removed.contains(anchorPos)) {
final int first = removed.getFirst();
final int last = removed.getLast();
代码示例来源:origin: org.apache.hadoop/hadoop-hdfs
public void bpThreadEnqueue(BPServiceActorAction action) {
synchronized (bpThreadQueue) {
if (!bpThreadQueue.contains(action)) {
bpThreadQueue.add(action);
}
}
}
代码示例来源:origin: cincheo/jsweet
/**
* Adds a directory that contains TypeScript definition files (sub-directories
* are scanned recursively to find all .d.ts files).
*
* @param tsDefDir
* a directory to scan for .d.ts files
*/
public void addTsDefDir(File tsDefDir) {
if (!tsDefDirs.contains(tsDefDir)) {
tsDefDirs.add(tsDefDir);
}
}
代码示例来源:origin: spotbugs/spotbugs
ClassDescriptor annotationClass = value.getAnnotationClass();
if (onStack.contains(annotationClass)) {
AnalysisContext.logError("Cycle found in type nicknames: " + onStack);
return;
onStack.add(annotationClass);
result.add(value);
内容来源于网络,如有侵权,请联系作者删除!