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


Java LinkedList.iterator方法代码示例

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


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

示例1: StringResourceLoader

import java.util.LinkedList; //导入方法依赖的package包/类
/**
   *
   * @param stringRes a Linked List with the correct format. Id : string
   * @throws ArrayIndexOutOfBoundsException if the list is not correctly
   * formatted
   */
  public StringResourceLoader(LinkedList<String> stringRes) throws ArrayIndexOutOfBoundsException {
      idsToString = new HashMap<>();
      
      for (Iterator<String> iterator = stringRes.iterator(); iterator.hasNext();) {
	String line = (String) iterator.next();
	
	
	if (line.length() != 0) {
              String[] split = line.split(":", 2);
              String id = split[0].trim();
              String displayedText = split[1].trim();

              idsToString.put(id.toLowerCase(), displayedText);
          }
}
  }
 
开发者ID:Skypr,项目名称:BEAST,代码行数:23,代码来源:StringResourceLoader.java

示例2: unitSystemString

import java.util.LinkedList; //导入方法依赖的package包/类
public static String[] unitSystemString() {
	LinkedList<String> ul = listUnitSystems();
	String[] us = new String[ul.size()];
	int x = 0;
	for (Iterator<String> e = ul.iterator(); e.hasNext();) {
		try {
			String enext = e.next().toString();
			enext = enext.substring(22, enext.length());
			us[x] = enext;
			x += 1;
		} catch (Throwable er) {
			System.err.println(er);
		}

	}
	return us;
}
 
开发者ID:etomica,项目名称:etomica,代码行数:18,代码来源:Lister.java

示例3: doDeleteCache

import java.util.LinkedList; //导入方法依赖的package包/类
private void doDeleteCache(TopicBean bean, boolean clear) {
    final LinkedList<String> cache = mCache;
    final List<TopicBean> cacheLocal = mLocalList;
    if (clear) {
        cache.clear();
        cacheLocal.clear();
    } else {
        Iterator<TopicBean> itr = cacheLocal.iterator();
        while (itr.hasNext()) {
            if (itr.next().equals(bean))
                itr.remove();
        }
        Iterator<String> itrCache = cache.iterator();
        while (itrCache.hasNext()) {
            if (itrCache.next().equals(bean.text))
                itrCache.remove();
        }
    }
    CacheManager.saveToJson(this, CACHE_FILE, cache);
    adapter.notifyDataSetChanged();
}
 
开发者ID:hsj-xiaokang,项目名称:OSchina_resources_android,代码行数:22,代码来源:TweetTopicActivity.java

示例4: MyTableModel

import java.util.LinkedList; //导入方法依赖的package包/类
public MyTableModel( LinkedList<Entity> entityList){
  if(entityList == null || entityList.size() == 0){
    
    return;
  }
  
  data = new Object[entityList.size()][columnNames.length];
  Iterator<Entity> itrEntities =  entityList.iterator();
  int rowIndex = 0;
  while (itrEntities.hasNext()){
    Entity anEntity = itrEntities.next();
    updateModelDataRow(rowIndex, anEntity);
    rowIndex++;
  }
  
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:17,代码来源:EntitiesViewer.java

示例5: filter

import java.util.LinkedList; //导入方法依赖的package包/类
public static String[] filter(Dimension dim, String[] unitString){
	LinkedList ll = new LinkedList();
	String[] newUnitString;
	for (int i = 0; i<unitString.length;i++){
	ll.add(unitString[i]);
	}
	ll = filter(dim,ll);
	newUnitString = new String[ll.size()];
	int count = 0;
	for (Iterator e = ll.iterator(); e.hasNext();){
		String enext = e.next().toString();
		newUnitString[count]=enext;
		count++;
		}
	return newUnitString;
}
 
开发者ID:etomica,项目名称:etomica,代码行数:17,代码来源:UnitFilter.java

示例6: outgoingEdges

import java.util.LinkedList; //导入方法依赖的package包/类
@Override
public Iterator<Edge> outgoingEdges(Vertex v) {
    LinkedList<Edge> edges = new LinkedList<>();
    LinkedList keys = vertices.keys();

    for (Object key: keys) {
        Float idEdge = adjacencyMatrix.get(v.getId(), (Integer) key);

        if (idEdge != null && idEdge != 0.0F)
            edges.add((Edge) this.edges.findElem((int) (float)idEdge));
    }

    return edges.iterator();
}
 
开发者ID:DaniloSI,项目名称:Tecnicas-de-Programacao-Avancada,代码行数:15,代码来源:GraphDirected.java

示例7: testIteratorOrdering

import java.util.LinkedList; //导入方法依赖的package包/类
/**
 * iterator ordering is FIFO
 */
public void testIteratorOrdering() {
    final LinkedList q = new LinkedList();
    q.add(new Integer(1));
    q.add(new Integer(2));
    q.add(new Integer(3));
    int k = 0;
    for (Iterator it = q.iterator(); it.hasNext();) {
        assertEquals(++k, it.next());
    }

    assertEquals(3, k);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:LinkedListTest.java

示例8: getCopy

import java.util.LinkedList; //导入方法依赖的package包/类
public void getCopy(boolean deepCopy, SubstrateNetwork result) {

		HashMap<String, SubstrateNode> map = new HashMap<String, SubstrateNode>();

		LinkedList<SubstrateLink> originalLinks = new LinkedList<SubstrateLink>(
				getEdges());
		SubstrateNode tmpSNode, tmpDNode;
		SubstrateLink tmpSLink;
		for (Iterator<SubstrateNode> tempSubsNode = getVertices().iterator(); tempSubsNode
				.hasNext();) {
			tmpSNode = tempSubsNode.next();
			if (deepCopy) {
				SubstrateNode clone = tmpSNode.getCopy(deepCopy);
				result.addVertex(clone);
				map.put(tmpSNode.getName(), clone);
			} else {
				result.addVertex(tmpSNode);
			}
		}
		for (Iterator<SubstrateLink> tempItSubLink = originalLinks.iterator(); tempItSubLink
				.hasNext();) {
			tmpSLink = tempItSubLink.next();
			tmpSNode = getSource(tmpSLink);
			tmpDNode = getDest(tmpSLink);

			if (deepCopy) {
				result.addEdge(tmpSLink.getCopy(deepCopy),
						map.get(tmpSNode.getName()),
						map.get(tmpDNode.getName()));
			} else {
				result.addEdge(tmpSLink, tmpSNode, tmpDNode);
			}
		}

	}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:36,代码来源:SubstrateNetwork.java

示例9: getTeamOfPlayer

import java.util.LinkedList; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
public static int getTeamOfPlayer(String name)
   {
       for (int i = 1; i <= players.size(); i++)
       {
           LinkedList temp = players.get(i);
           Iterator it = temp.iterator();
           while (it.hasNext())
           {
               if (it.next().equals(name)) return i;
           }
       }
       return 0;
   }
 
开发者ID:L2jBrasil,项目名称:L2jBrasil,代码行数:15,代码来源:L2Event.java

示例10: eliminateNonRoutes

import java.util.LinkedList; //导入方法依赖的package包/类
private LinkedList eliminateNonRoutes(LinkedList solution) {
	LinkedList newList = new LinkedList();
	for (Iterator iter = solution.iterator(); iter.hasNext();) {
		TWVehicleRoute element = (TWVehicleRoute) iter.next();
		if (element.suppliedDemand > 0) {
			newList.add(element);
		}
	}

	return newList;
}
 
开发者ID:guilhebl,项目名称:routerapp,代码行数:12,代码来源:SimulatedAnnealing.java

示例11: testIteratorRemove

import java.util.LinkedList; //导入方法依赖的package包/类
/**
 * iterator.remove removes current element
 */
public void testIteratorRemove() {
    final LinkedList q = new LinkedList();
    q.add(new Integer(1));
    q.add(new Integer(2));
    q.add(new Integer(3));
    Iterator it = q.iterator();
    assertEquals(1, it.next());
    it.remove();
    it = q.iterator();
    assertEquals(2, it.next());
    assertEquals(3, it.next());
    assertFalse(it.hasNext());
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:LinkedListTest.java

示例12: polyTeam

import java.util.LinkedList; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
void polyTeam(int team, String id){
       LinkedList linked = L2Event.players.get(team);
       Iterator it = linked.iterator();
       while(it.hasNext()){
        try{   L2PcInstance target = L2World.getInstance().getPlayer(it.next().toString());
        target.getPoly().setPolyInfo("npc", id);
        target.teleToLocation(target.getX(), target.getY(), target.getZ(), true);
        CharInfo info1 = new CharInfo(target);
        target.broadcastPacket(info1);
            UserInfo info2 = new UserInfo(target);
            target.sendPacket(info2);}catch(Exception e){}
       }

   }
 
开发者ID:L2jBrasil,项目名称:L2jBrasil,代码行数:16,代码来源:AdminEventEngine.java

示例13: inheritClass

import java.util.LinkedList; //导入方法依赖的package包/类
private void inheritClass() {
    // Grab all Klasses from the TypeList and select one to be a parent
    LinkedList<Type> probableParents = new LinkedList<>(TypeList.getAll());
    for (Iterator<Type> i = probableParents.iterator(); i.hasNext();) {
        Type klass = i.next();
        if (!(klass instanceof TypeKlass) || ((TypeKlass) klass).isFinal()
                || ((TypeKlass) klass).isInterface()) {
            // we can not derive from finals and interfaces
            i.remove();
        }
    }
    if (probableParents.isEmpty()) {
        parent = TypeList.OBJECT;
    } else {
        parent = (TypeKlass) PseudoRandom.randomElement(probableParents);
    }
    thisKlass.addParent(parent.getName());
    thisKlass.setParent(parent);
    parent.addChild(name);
    for (Symbol symbol : SymbolTable.getAllCombined(parent)) {
        if ((symbol.flags & Symbol.PRIVATE) == 0) {
            Symbol symbolCopy = symbol.deepCopy();
            if (symbolCopy instanceof FunctionInfo) {
                FunctionInfo functionInfo = (FunctionInfo) symbolCopy;
                if (functionInfo.isConstructor()) {
                    continue;
                }
                if ((functionInfo.flags & FunctionInfo.STATIC) == 0) {
                    functionInfo.argTypes.get(0).type = thisKlass;
                }
            }
            symbolCopy.owner = thisKlass;
            SymbolTable.add(symbolCopy);
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:37,代码来源:KlassFactory.java

示例14: findOnsets

import java.util.LinkedList; //导入方法依赖的package包/类
private void findOnsets(double p1, double p2){
	LinkedList<Integer> peaks = Peaks.findPeaks(spectralFlux, (int)Math.round(0.06 / hopTime), p1, p2, true);
	Iterator<Integer> it = peaks.iterator();

	double minSalience = Peaks.min(spectralFlux);
	for (int i = 0; i < peaks.size(); i++) {
		int index = it.next();
		double time  = index * hopTime;
		double salience = spectralFlux[index] - minSalience;
		handler.handleOnset(time,salience);
	}
}
 
开发者ID:gstraube,项目名称:cythara,代码行数:13,代码来源:BeatRootSpectralFluxOnsetDetector.java

示例15: CopiedIterator

import java.util.LinkedList; //导入方法依赖的package包/类
public CopiedIterator(Iterator itr) {
LinkedList list = new LinkedList( );
while(itr.hasNext( )) {
list.add(itr.next( ));
}
this.iterator = list.iterator( );
}
 
开发者ID:jonasxiao,项目名称:FinalSpeed,代码行数:8,代码来源:CopiedIterator.java


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