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


Java List.iterator方法代码示例

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


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

示例1: buildSetForBodies

import java.util.List; //导入方法依赖的package包/类
private AnimatorSet buildSetForBodies(List<CustomAnimationBody> animations, View view) {
    final AnimatorSet animatorSet = new AnimatorSet();

    if (animations.size() > 0) {
        final Iterator<CustomAnimationBody> iterator = animations.iterator();

        final AnimatorSet.Builder builder =
                animatorSet.play(iterator.next().createFor(view));

        while (iterator.hasNext()) {
            builder.with(iterator.next().createFor(view));
        }
    }

    return animatorSet;
}
 
开发者ID:Appolica,项目名称:Flubber,代码行数:17,代码来源:MainActivity.java

示例2: checkedListByCopy

import java.util.List; //导入方法依赖的package包/类
/**
 * Create a typesafe copy of a raw list.
 * @param rawList an unchecked list
 * @param type the desired supertype of the entries
 * @param strict true to throw a <code>ClassCastException</code> if the raw list has an invalid entry,
 *               false to skip over such entries (warnings may be logged)
 * @return a typed list guaranteed to contain only entries assignable
 *         to the named type (or they may be null)
 * @throws ClassCastException if some entry in the raw list was not well-typed, and only if <code>strict</code> was true
 */
public static <E> List<E> checkedListByCopy(List rawList, Class<E> type, boolean strict) throws ClassCastException {
    List<E> l = (rawList instanceof RandomAccess) ? new ArrayList<E>(rawList.size()) : new LinkedList<E>();
    Iterator it = rawList.iterator();
    while (it.hasNext()) {
        Object e = it.next();
        try {
            l.add(type.cast(e));
        } catch (ClassCastException x) {
            if (strict) {
                throw x;
            } else {
                LOG.log(Level.WARNING, "Element {0} not assignable to {1}", new Object[] {e, type});
            }
        }
    }
    return l;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:NbCollections.java

示例3: selectExtensions

import java.util.List; //导入方法依赖的package包/类
protected final void selectExtensions(final WebSocketHttpExchange exchange) {
    List<WebSocketExtension> requestedExtensions = WebSocketExtension.parse(exchange.getRequestHeader(Headers.SEC_WEB_SOCKET_EXTENSIONS_STRING));
    List<WebSocketExtension> extensions = selectedExtension(requestedExtensions);
    if (extensions != null && !extensions.isEmpty()) {
        StringBuilder sb = new StringBuilder();
        Iterator<WebSocketExtension> it = extensions.iterator();
        while (it.hasNext()) {
            WebSocketExtension next = it.next();
            sb.append(next.getName());
            for (WebSocketExtension.Parameter param : next.getParameters()) {
                sb.append("; ");
                sb.append(param.getName());
                sb.append("=");
                sb.append(param.getValue());
            }
            if (it.hasNext()) {
                sb.append(", ");
            }
        }
        exchange.setResponseHeader(Headers.SEC_WEB_SOCKET_EXTENSIONS_STRING, sb.toString());
    }

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:24,代码来源:Handshake.java

示例4: addInclude

import java.util.List; //导入方法依赖的package包/类
private void addInclude(Node parent, List<String> files) throws SAXException {
    if (files != null) {
        Iterator<String> iter = files.iterator();
        while (iter.hasNext()) {
            String file = iter.next();
            AttributesImpl attrs = new AttributesImpl();
            attrs.addAttribute("", "file", "file", "CDATA", file);

            // Create a dummy Include directive node
                Node includeDir =
                    new Node.IncludeDirective(attrs, null, // XXX
parent);
            processIncludeDirective(file, includeDir);
        }
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:17,代码来源:JspDocumentParser.java

示例5: download4PassAuthorizationApi

import java.util.List; //导入方法依赖的package包/类
@Override
public List<ItemAuthResultModel> download4PassAuthorizationApi(RequestAuthBodyModel requestAuthBodyModel){
    if(null == requestAuthBodyModel){return null;}

    /** 通过router_mac查询device_mac,找到order_id */
    if(null == requestAuthBodyModel.getRouterMac()){return null;}

    List<Guest4RouterModel> guest4RouterModelList = routerGuestModelJpaGerepository.findByRouterMac(requestAuthBodyModel.getRouterMac());
    if(null == guest4RouterModelList){return null;}
    List<ItemAuthResultModel> itemAuthResultModelList = new ArrayList<>();
    Iterator iterator = guest4RouterModelList.iterator();
    while(iterator.hasNext())
    {
        Guest4RouterModel guest4RouterModel = (Guest4RouterModel)(iterator.next());

        List<GuestOrder> guestOrderList = routerGuestOrderModelJpaGerepository.findPassAuthorizationByGuestIdAndOrderStatus(guest4RouterModel.getId(), Const.OrderStatusInterfaces.ORDER_STATUS_PAIDINCOMMON);
        if((null != guestOrderList)&&(guestOrderList.size()>0))
        {
            itemAuthResultModelList.add(new ItemAuthResultModel(Const.GuestAuthorityResultInterfaces.AUTHORITY_RESULT_OK,
                    guest4RouterModel.getDeviceMac(),
                    guestOrderList.get(0).getOrderId()));
        }
    }

    return itemAuthResultModelList;
}
 
开发者ID:rongwei84n,项目名称:Auts_Assert_manager,代码行数:27,代码来源:AuthBeatResponseModelServiceImpl.java

示例6: getNodeList

import java.util.List; //导入方法依赖的package包/类
@Override
   public SortedMap getNodeList(ITicket ticket) throws AccessDeniedException {

Long workspaceId = ticket.getWorkspaceId();
List nodes = workspaceDAO.findWorkspaceNodes(workspaceId);

if (log.isDebugEnabled()) {
    log.debug("Workspace " + workspaceId + " has " + nodes.size() + " nodes.");
}

TreeMap map = new TreeMap();
Iterator iter = nodes.iterator();
while (iter.hasNext()) {
    CrNode node = (CrNode) iter.next();
    map.put(node.getNodeId(), node.getVersionHistory());
}

return map;
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:20,代码来源:SimpleRepository.java

示例7: initDisplayer

import java.util.List; //导入方法依赖的package包/类
/**
 * Fills contentDisplayer container with components retrieved from model.
 */
protected void initDisplayer() {
    if (container.getContentPolicy() == TabbedContainer.CONTENT_POLICY_ADD_ALL) {
        List tabs = container.getModel().getTabs();
        Component curC = null;
        for (Iterator iter = tabs.iterator(); iter.hasNext();) {
            curC = toComp ((TabData) iter.next());
            // string parameter is needed for StackLayout to kick in correctly
            contentDisplayer.add(curC, "");
        }
    } else {
        int i = tabDisplayer.getSelectionModel().getSelectedIndex();
        if (i != -1) {
            TabData td = container.getModel().getTab(i);
            contentDisplayer.add(toComp(td), "");
        }
    }
    updateActiveState();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:DefaultTabbedContainerUI.java

示例8: escapeJSStringArray

import java.util.List; //导入方法依赖的package包/类
public static String escapeJSStringArray(List<String> valueList, boolean brackets, boolean quotes) {
	StringBuilder sb;
	if (brackets) {
		sb = new StringBuilder("[");
	} else {
		sb = new StringBuilder();
	}
	if (valueList != null && valueList.size() > 0) {
		Iterator<String> it = valueList.iterator();
		while (it.hasNext()) {
			sb.append(quoteJSString(it.next(), brackets || quotes));
			if (it.hasNext()) {
				sb.append(",");
			}
		}
	}
	if (brackets) {
		sb.append("]");
	}
	return sb.toString();
}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:22,代码来源:WebUtil.java

示例9: getCandidateLocales

import java.util.List; //导入方法依赖的package包/类
@Override
public List<Locale> getCandidateLocales(String baseName, Locale locale) {
    String key = baseName + '-' + locale.toLanguageTag();
    List<Locale> candidates = CANDIDATES_MAP.get(key);
    if (candidates == null) {
        LocaleProviderAdapter.Type type = baseName.contains(DOTCLDR) ? CLDR : JRE;
        LocaleProviderAdapter adapter = LocaleProviderAdapter.forType(type);
        candidates = adapter instanceof ResourceBundleBasedAdapter ?
            ((ResourceBundleBasedAdapter)adapter).getCandidateLocales(baseName, locale) :
            defaultControl.getCandidateLocales(baseName, locale);

        // Weed out Locales which are known to have no resource bundles
        int lastDot = baseName.lastIndexOf('.');
        String category = (lastDot >= 0) ? baseName.substring(lastDot + 1) : baseName;
        Set<String> langtags = ((JRELocaleProviderAdapter)adapter).getLanguageTagSet(category);
        if (!langtags.isEmpty()) {
            for (Iterator<Locale> itr = candidates.iterator(); itr.hasNext();) {
                if (!adapter.isSupportedProviderLocale(itr.next(), langtags)) {
                    itr.remove();
                }
            }
        }
        // Force fallback to Locale.ENGLISH for CLDR time zone names support
        if (locale.getLanguage() != "en"
                && type == CLDR && category.equals("TimeZoneNames")) {
            candidates.add(candidates.size() - 1, Locale.ENGLISH);
        }
        CANDIDATES_MAP.putIfAbsent(key, candidates);
    }
    return candidates;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:32,代码来源:LocaleData.java

示例10: print

import java.util.List; //导入方法依赖的package包/类
private void print (List l, String indent) {
    Iterator it = l.iterator ();
    while (it.hasNext ()) {
        Object next = it.next ();
        System.out.println (indent + next);
        if (next instanceof ASTToken) continue;
        print ((List) it.next (), indent + "  ");
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:AnalyserTest.java

示例11: overrideIndexedAnnotationMap

import java.util.List; //导入方法依赖的package包/类
@Override
protected void overrideIndexedAnnotationMap(DotName annName, AnnotationInstance annotationInstance, Map<DotName, List<AnnotationInstance>> map) {
	ExclusiveGroup group = getExclusiveGroup( annName );
	if ( group == null ) {
		return;
	}
	AnnotationTarget target = annotationInstance.target();
	for ( DotName entityAnnName : group ) {
		if ( !map.containsKey( entityAnnName ) ) {
			continue;
		}
		switch ( group.scope ) {
			case TYPE:
				map.put( entityAnnName, Collections.<AnnotationInstance>emptyList() );
				break;
			case ATTRIBUTE:
				List<AnnotationInstance> indexedAnnotationInstanceList = map.get( entityAnnName );
				Iterator<AnnotationInstance> iter = indexedAnnotationInstanceList.iterator();
				while ( iter.hasNext() ) {
					AnnotationInstance ann = iter.next();
					if ( MockHelper.targetEquals( target, ann.target() ) ) {
						iter.remove();
					}
				}
				break;
		}
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:29,代码来源:ExclusiveAnnotationFilter.java

示例12: findLaunchingConnector

import java.util.List; //导入方法依赖的package包/类
/**
 * Find a com.sun.jdi.CommandLineLaunch connector
 */
static LaunchingConnector findLaunchingConnector() {
    List <Connector> connectors = Bootstrap.virtualMachineManager().allConnectors();
    Iterator <Connector> iter = connectors.iterator();
    while (iter.hasNext()) {
        Connector connector = iter.next();
        if (connector.name().equals("com.sun.jdi.CommandLineLaunch")) {
            return (LaunchingConnector)connector;
        }
    }
    throw new Error("No launching connector");
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:GetObjectLockCount.java

示例13: testAdvance_illegalArgument

import java.util.List; //导入方法依赖的package包/类
public void testAdvance_illegalArgument() {
  List<String> list = newArrayList("a", "b", "c");
  Iterator<String> iterator = list.iterator();
  try {
    advance(iterator, -1);
    fail();
  } catch (IllegalArgumentException expected) {}
}
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:9,代码来源:IteratorsTest.java

示例14: filterListForMe

import java.util.List; //导入方法依赖的package包/类
private static void filterListForMe(List<Job> joblist) {
	for (Iterator<Job> iterator = joblist.iterator(); iterator.hasNext();) {
		Job job = iterator.next();
		if(job.getCode().equals("Basic"))
			iterator.remove();
		else if(!job.getMethod().equals("max"))
			iterator.remove();
		else if(job.getContractNumber() != 0)
			iterator.remove();
	}
}
 
开发者ID:NeoRoy,项目名称:KeYExperienceReport,代码行数:12,代码来源:Server.java

示例15: iterator

import java.util.List; //导入方法依赖的package包/类
/**
 * @see com.oxygenxml.translation.support.core.resource.IResource#iterator()
 */
public Iterator<IResource> iterator() {
  if (logger.isDebugEnabled()) {
    logger.debug("Get iterator for: " + file);
  }
  Iterator<IResource> toReturn = null;
  File[] listFiles = file.listFiles();
  if (listFiles != null) {
    List<IResource>  children = new ArrayList<IResource>(listFiles.length);
    StringBuilder b = new StringBuilder();
    for (int i = 0; i < listFiles.length; i++) {
      File child = listFiles[i];
      if (!child.getName().contains(MilestoneUtil.MILESTONE_FILE_NAME)) {
        // The milestone must not be added in the package.
        b.setLength(0);
        if (relativePath.length() > 0) {
          b.append(relativePath).append("/");
        }
        b.append(child.getName());
        if (logger.isDebugEnabled()) {
          logger.debug("  Child: " + child);
        }
        children.add(wrap(child, b.toString()));
      }
    }
    
    toReturn = children.iterator();
  }
  
  return toReturn;
}
 
开发者ID:oxygenxml,项目名称:oxygen-dita-translation-package-builder,代码行数:34,代码来源:FileSystemResourceBuilder.java


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