本文整理汇总了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);
}
}
}
示例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;
}
示例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();
}
示例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++;
}
}
示例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;
}
示例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();
}
示例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);
}
示例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);
}
}
}
示例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;
}
示例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;
}
示例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());
}
示例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){}
}
}
示例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);
}
}
}
示例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);
}
}
示例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( );
}