当前位置: 首页>>代码示例>>Java>>正文


Java LinkedList.contains方法代码示例

本文整理汇总了Java中java.util.LinkedList.contains方法的典型用法代码示例。如果您正苦于以下问题:Java LinkedList.contains方法的具体用法?Java LinkedList.contains怎么用?Java LinkedList.contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.LinkedList的用法示例。


在下文中一共展示了LinkedList.contains方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAllEntitiesCarriedBySimEventsAtCurrentClockNoTrash

import java.util.LinkedList; //导入方法依赖的package包/类
public static LinkedList<Entity> getAllEntitiesCarriedBySimEventsAtCurrentClockNoTrash(){
  LinkedList<Entity> returnList = new LinkedList<Entity>();
  LinkedList<Integer> entityTags = new LinkedList<Integer>();
  
  Iterator<SimEvent> itrEvents = ((HybridEventQueue)SimSystem.getFutureQueue()).getCurrentList().iterator();
  while(itrEvents.hasNext()){
    SimEvent anEvent = itrEvents.next();
    if(anEvent.eventTime() == SimSystem.clock()){
      Job job = (Job)anEvent.getData();
      
      if(job == null) 
      	continue;
      
      Entity entity = job.qnactrEntity;
      if(!entityTags.contains(entity.Tag) && !entity.Trash){
        entityTags.addLast(entity.Tag);
        returnList.addLast(entity);
      }
    }
    
  }
  
  return returnList;
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:25,代码来源:QnactrSimulation.java

示例2: calculate

import java.util.LinkedList; //导入方法依赖的package包/类
public double calculate(NetworkStack stack) {
	
	LinkedList<Integer> vnetslayers = new LinkedList<Integer>();
	for (SubstrateNode sn : stack.getSubstrate().getVertices()) {
		for (AbstractResource r : sn.get()) {
			for (Mapping m : r.getMappings()) {
				if (m.getDemand().getOwner() != null) {
					if (!vnetslayers.contains(m.getDemand().getOwner().getLayer())) {
						vnetslayers.add(m.getDemand().getOwner().getLayer());
					}
				}
			}
		}
	}
	
	return vnetslayers.size();
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:18,代码来源:NumberOfEmbeddedVNets.java

示例3: getShortestPathsALinkGoesThrough

import java.util.LinkedList; //导入方法依赖的package包/类
public static Collection<LinkedList<SubstrateLink>> getShortestPathsALinkGoesThrough(
		SubstrateNetwork sNetwork,
		SubstrateLink l,
		Transformer<SubstrateLink, Double> t) {
	
	Collection<LinkedList<SubstrateLink>> result = new LinkedList<LinkedList<SubstrateLink>>();
	
	Map<SubstrateNode, Collection<LinkedList<SubstrateLink>>> all =
			Utils.findAllShortestPaths(sNetwork, t);
	
	for (Entry<SubstrateNode, Collection<LinkedList<SubstrateLink>>> e : all.entrySet()) {
		for (LinkedList<SubstrateLink> path : e.getValue()) {
			
			if (path.contains(l)) {
				result.add(path);
				break;
			}
		}
	}
	
	return result;
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:23,代码来源:Utils.java

示例4: main

import java.util.LinkedList; //导入方法依赖的package包/类
public static void main(String args[]) throws Exception {

        LinkedList<String> options = new LinkedList<>(Arrays.asList(Utils.getTestJavaOpts()));

        // Need to consider the effect of TargetPLABWastePct=1 for G1 GC
        if (options.contains("-XX:+UseG1GC")) {
            VARIANCE = 2;
        } else {
            VARIANCE = 1;
        }

        negativeTest(-1, options);
        negativeTest(101, options);

        positiveTest(20, options);
        positiveTest(30, options);
        positiveTest(55, options);
        positiveTest(70, options);
    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:TestTargetSurvivorRatioFlag.java

示例5: getCredentials

import java.util.LinkedList; //导入方法依赖的package包/类
public static String getCredentials(String smbPath, boolean forceCheck){
    if (!forceCheck && smbPath.indexOf('@') != -1){
        return smbPath;
    }
    LinkedList<String> credentialsList = getSingleSettingList();
    String noCreds = getNoCredentialsPath(smbPath);
    String path = noCreds;
    int position;
    while((position = path.lastIndexOf('/')) > 5){
        if (credentialsList.contains(path.substring(5, position+1))){
            String section = handleCredentials(path.substring(0, position+1));
            section = section.substring(0, section.length());
            return section+noCreds.substring(position+1);
        }
        path = path.substring(0, position);
    }
    return smbPath;
}
 
开发者ID:archos-sa,项目名称:aos-FileCoreLibrary,代码行数:19,代码来源:SambaConfiguration.java

示例6: removeClientId

import java.util.LinkedList; //导入方法依赖的package包/类
public static void removeClientId(String clientId) {
    Iterator<LinkedList<Message>> collection = container.values().iterator();
    LinkedList<Message> messages;
    Message message = new Message();
    message.setClientId(clientId);
    while (collection.hasNext()) {
        messages = collection.next();
        if (messages.contains(message)) {
            messages.remove(message);
        }
    }
}
 
开发者ID:airballcz,项目名称:iot-platform,代码行数:13,代码来源:SubscribeContainer.java

示例7: saveCache

import java.util.LinkedList; //导入方法依赖的package包/类
public static void saveCache(Context context, String... strs) {
    final ArrayList<String> hotCaches = CollectionUtil.toArrayList(loadHotCache(context.getResources()));
    final LinkedList<String> localCache = loadCache(context);

    // 避免重复添加
    for (String str : strs) {
        if (TextUtils.isEmpty(str) || TextUtils.isEmpty(str = str.trim()))
            continue;
        if (!hotCaches.contains(str) && !localCache.contains(str)) {
            localCache.addFirst(str);
        }
    }

    // 至多存储15条
    while (localCache.size() > 15) {
        localCache.removeLast();
    }

    CacheManager.saveToJson(context, CACHE_FILE, localCache);
}
 
开发者ID:hsj-xiaokang,项目名称:OSchina_resources_android,代码行数:21,代码来源:TweetTopicActivity.java

示例8: stringToList

import java.util.LinkedList; //导入方法依赖的package包/类
private LinkedList<String> stringToList(String str) {
    LinkedList<String> ll = new LinkedList<>();

    // comma and space are valid delimites
    StringTokenizer st = new StringTokenizer(str, ", ");
    while (st.hasMoreTokens()) {
        String s = st.nextToken();
        if (!ll.contains(s)) {
            ll.add(s);
        }
    }
    return ll;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:ResolverConfigurationImpl.java

示例9: allEdges

import java.util.LinkedList; //导入方法依赖的package包/类
/**
 * Finds all edge instances in the given array of faces, and returns
 * them in an array.  Each edge appears in the array once, although it
 * should be part of multiple faces.  Used by constructor.
 */
private static LineSegment[] allEdges(Polygon[] faces) {
    LinkedList list = new LinkedList();
    for(int i=0; i<faces.length; i++) {
        LineSegment[] edges= faces[i].getEdges();
        for(int j=0; j<edges.length; j++) {
            if(!list.contains(edges[j])) {
                list.add(edges[j]);
            }
        }
    }
    return (LineSegment[])list.toArray(new LineSegment[0]);
}
 
开发者ID:etomica,项目名称:etomica,代码行数:18,代码来源:Polyhedron.java

示例10: allVertices

import java.util.LinkedList; //导入方法依赖的package包/类
/**
 * Returns a list of all vertices appearing in the given array of
 * polytopes.  Each vertex appears in the list only once.  Used
 * by constructor.
 */
private static Vector[] allVertices(Polytope[] hyperPlanes) {
    LinkedList list = new LinkedList();
    for (int i = 0; i < hyperPlanes.length; i++) {
        Vector[] vertices = hyperPlanes[i].vertices;
        for (int j = 0; j < vertices.length; j++) {
            if (!list.contains(vertices[j])) {
                list.add(vertices[j]);
            }
        }
    }
    return (Vector[]) list.toArray(new Vector[0]);
}
 
开发者ID:etomica,项目名称:etomica,代码行数:18,代码来源:Polytope.java

示例11: searchByClosest

import java.util.LinkedList; //导入方法依赖的package包/类
public List<AbstractNodeLoc> searchByClosest(Node start, Node end)
{
	// Always continues checking from the closest to target non-blocked
	// node from to_visit list. There's extra length in path if needed
	// to go backwards/sideways but when moving generally forwards, this is extra fast
	// and accurate. And can reach insane distances (try it with 800 nodes..).
	// Minimum required node count would be around 300-400.
	// Generally returns a bit (only a bit) more intelligent looking routes than
	// the basic version. Not a true distance image (which would increase CPU
	// load) level of intelligence though.

	// List of Visited Nodes
	FastNodeList visited = new FastNodeList(550);

	// List of Nodes to Visit
	LinkedList<Node> to_visit = new LinkedList<Node>();
	to_visit.add(start);
	short targetx = end.getLoc().getNodeX();
	short targety = end.getLoc().getNodeY();
	int dx, dy;
	boolean added;
	int i = 0;
	while (i < 550)
	{
		Node node;
		try
		{
			 node = to_visit.removeFirst();
		}
		catch (Exception e)
		{
			// No Path found
			return null;
		}
		if (node.equals(end)) //path found!
			return constructPath(node);
		else
		{
			i++;
			visited.add(node);
			node.attacheNeighbors();
			Node[] neighbors = node.getNeighbors();
			if (neighbors == null) continue;
			for (Node n : neighbors)
			{
				if (!visited.containsRev(n) && !to_visit.contains(n))
				{
					added = false;
					n.setParent(node);
					dx = targetx - n.getLoc().getNodeX();
					dy = targety - n.getLoc().getNodeY();
					n.setCost(dx*dx+dy*dy);
					for (int index = 0; index < to_visit.size(); index++)
					{
						// supposed to find it quite early..
						if (to_visit.get(index).getCost() > n.getCost())
						{
							to_visit.add(index, n);
							added = true;
							break;
						}
					}
					if (!added) to_visit.addLast(n);
				}
			}
		}
	}
	//No Path found
	return null;
}
 
开发者ID:L2jBrasil,项目名称:L2jBrasil,代码行数:71,代码来源:PathFinding.java

示例12: URLs2Projects

import java.util.LinkedList; //导入方法依赖的package包/类
private static LinkedList<Project> URLs2Projects( Collection<URL> URLs ) {
    LinkedList<Project> result = new LinkedList<Project>();
        
    for(URL url: URLs) {
        FileObject dir = URLMapper.findFileObject( url );
        if ( dir != null && dir.isFolder() ) {
            try {
                Project p = ProjectManager.getDefault().findProject( dir );
                if ( p != null && !result.contains(p)) { //#238093, #238811 if multiple entries point to the same project we end up with the same instance multiple times in the linked list. That's wrong.
                    result.add( p );
                }
            }       
            catch ( Throwable t ) {
                //something bad happened during loading the project.
                //log the problem, but allow the other projects to be load
                //see issue #65900
                if (t instanceof ThreadDeath) {
                    throw (ThreadDeath) t;
                }
                
                ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, t);
            }
        }
    }
    
    return result;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:OpenProjectList.java

示例13: addFileStatusListener

import java.util.LinkedList; //导入方法依赖的package包/类
public final void addFileStatusListener (FileStatusListener l, FileObject mfo) {
    synchronized (listeners) {
        LinkedList<FileObject> lst = null;
        if (!listeners.containsKey (l)) {
            lst = new LinkedList<FileObject> ();
            listeners.put (l, lst);
        }
        else
            lst = listeners.get (l);
        
        if (!lst.contains (mfo))
            lst.add (mfo);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:FileStateManager.java

示例14: fireFileStatusChanged

import java.util.LinkedList; //导入方法依赖的package包/类
@SuppressWarnings("unchecked") 
private void fireFileStatusChanged (FileObject mfo) {
    HashMap<FileStatusListener,LinkedList<FileObject>> h = null;
    
    synchronized (listeners) {
        h = (HashMap<FileStatusListener,LinkedList<FileObject>>)listeners.clone ();
    }
    
    for (Entry<FileStatusListener,LinkedList<FileObject>> entry: h.entrySet()) {
        FileStatusListener l = entry.getKey();
        LinkedList<FileObject> lst = entry.getValue();
        if (lst.contains (mfo))
            l.fileStatusChanged (mfo);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:FileStateManager.java

示例15: addEdge

import java.util.LinkedList; //导入方法依赖的package包/类
public void addEdge(StationGraphVO fromVertex, StationGraphVO... toVertice) {
	if (!edgesByVertices.containsKey(fromVertex))
		throw new NullPointerException("The fromVertex is not exists.");

	for(StationGraphVO toVertex : toVertice) {
		if (!edgesByVertices.containsKey(toVertex))
			throw new NullPointerException("The toVertex is not exists.");
		
		toVertex.setIdentifier(Identifier.NEXT);
		fromVertex.setIdentifier(Identifier.PREVIOUS);
		
		
		LinkedList<Edge> edges = edgesByVertices.get(fromVertex);
		Edge newEdge = new Edge(fromVertex, toVertex);
		// 중복 추가 방지 (정점 하나에 이어진 정점이 2개 이상 포함될 수가 없으므로)
		if(edges.contains(newEdge))
			return;
		
		edges.add(newEdge);
		
		// 무방향 그래프 대칭 처리
		if (graphType == GraphType.UNDIRECTED)
			addVertexForUndirectGraph(toVertex, fromVertex);
	}

	// fromVertex만 현재역으로 변환
	for(LinkedList<Edge> vertex : edgesByVertices.values()) {
		for(Edge edge : vertex) {
			edge.fromVertex.setIdentifier(Identifier.CURRENT);
		}
	}
}
 
开发者ID:xeyez,项目名称:StationGraph,代码行数:33,代码来源:StationGraph.java


注:本文中的java.util.LinkedList.contains方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。