當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。