java.util.Iterator

Here are the examples of the java api class java.util.Iterator taken from open source projects.

1. GBeanInfo#toString()

Project: geronimo
Source File: GBeanInfo.java
View license
public String toString() {
    StringBuffer result = new StringBuffer("[GBeanInfo:");
    result.append(" id=").append(super.toString());
    result.append(" sourceClass=").append(sourceClass);
    result.append(" name=").append(name);
    for (Iterator iterator = attributes.iterator(); iterator.hasNext(); ) {
        GAttributeInfo geronimoAttributeInfo = (GAttributeInfo) iterator.next();
        result.append("\n    attribute: ").append(geronimoAttributeInfo);
    }
    for (Iterator iterator = operations.iterator(); iterator.hasNext(); ) {
        GOperationInfo geronimoOperationInfo = (GOperationInfo) iterator.next();
        result.append("\n    operation: ").append(geronimoOperationInfo);
    }
    for (Iterator iterator = references.iterator(); iterator.hasNext(); ) {
        GReferenceInfo referenceInfo = (GReferenceInfo) iterator.next();
        result.append("\n    reference: ").append(referenceInfo);
    }
    result.append("]");
    return result.toString();
}

2. Ivy#sync()

Project: ant-ivy
Source File: Ivy.java
View license
private void sync(Collection target, Collection existing) {
    Collection toRemove = new HashSet();
    for (Iterator iter = existing.iterator(); iter.hasNext(); ) {
        File file = (File) iter.next();
        toRemove.add(file.getAbsoluteFile());
    }
    for (Iterator iter = target.iterator(); iter.hasNext(); ) {
        File file = (File) iter.next();
        toRemove.remove(file.getAbsoluteFile());
    }
    for (Iterator iter = toRemove.iterator(); iter.hasNext(); ) {
        File file = (File) iter.next();
        if (file.exists()) {
            Message.verbose("\t\tdeleting " + file);
            FileUtil.forceDelete(file);
        }
    }
}

3. RendererFactory#listSupportedMimeTypes()

Project: fop
Source File: RendererFactory.java
View license
/**
     * @return an array of all supported MIME types
     */
public String[] listSupportedMimeTypes() {
    List lst = new java.util.ArrayList();
    Iterator iter = this.rendererMakerMapping.keySet().iterator();
    while (iter.hasNext()) {
        lst.add(iter.next());
    }
    iter = this.eventHandlerMakerMapping.keySet().iterator();
    while (iter.hasNext()) {
        lst.add(iter.next());
    }
    iter = this.documentHandlerMakerMapping.keySet().iterator();
    while (iter.hasNext()) {
        lst.add(iter.next());
    }
    Collections.sort(lst);
    return (String[]) lst.toArray(new String[lst.size()]);
}

4. SootJimpleJavaProjectLauncher#setCmd()

View license
private void setCmd() {
    ArrayList commands = new ArrayList();
    commands.add("--" + LaunchCommands.SOOT_CLASSPATH);
    Iterator it = getJavaProcessPath().iterator();
    String cp = (String) it.next();
    while (it.hasNext()) {
        cp = cp + getSootClasspath().getSeparator() + (String) it.next();
    }
    cp = cp + getSootClasspath().getSeparator() + getClasspathAppend();
    commands.add(cp);
    commands.add("--" + LaunchCommands.OUTPUT_DIR);
    commands.add(getOutputLocation());
    getSootCommandList().addSingleOpt("--" + LaunchCommands.KEEP_LINE_NUMBER);
    getSootCommandList().addSingleOpt("--" + LaunchCommands.XML_ATTRIBUTES);
    Iterator it2 = getJavaProcessPath().iterator();
    while (it2.hasNext()) {
        commands.add("--" + LaunchCommands.PROCESS_PATH);
        commands.add((String) it2.next());
    }
    getSootCommandList().addDoubleOpt("--" + LaunchCommands.OUTPUT, LaunchCommands.JIMPLE_OUT);
    getSootCommandList().addDoubleOpt("--" + LaunchCommands.SRC_PREC, "java");
    getSootCommandList().addSingleOpt(commands);
}

5. StreamingXmlParser#toField()

View license
Map<String, Field> toField(StartElement startE) {
    Map<String, Field> map = new LinkedHashMap<>();
    Iterator attrs = startE.getAttributes();
    while (attrs.hasNext()) {
        Attribute attr = (Attribute) attrs.next();
        map.put(getName(ATTR_PREFIX_KEY, attr), Field.create(attr.getValue()));
    }
    Iterator nss = startE.getNamespaces();
    while (nss.hasNext()) {
        Namespace ns = (Namespace) nss.next();
        map.put(getName(NS_PREFIX_KEY, ns), Field.create(ns.getNamespaceURI()));
    }
    return map;
}

6. AxisService2WSDL20#generateRPCSignature()

Project: axis2-java
Source File: AxisService2WSDL20.java
View license
private String generateRPCSignature(Map inMessageElementDetails, Map outMessageElementDetails) {
    String in = "";
    String out = "";
    String inOut = "";
    Set inElementSet = inMessageElementDetails.keySet();
    Set outElementSet = outMessageElementDetails.keySet();
    Iterator inElementIterator = inElementSet.iterator();
    while (inElementIterator.hasNext()) {
        String inElementName = (String) inElementIterator.next();
        if (outElementSet.contains(inElementName)) {
            inOut = inOut + inElementName + " " + WSDL2Constants.RPC_INOUT + " ";
            outElementSet.remove(inElementName);
        } else {
            in = in + inElementName + " " + WSDL2Constants.RPC_IN + " ";
        }
    }
    Iterator outElementIterator = outElementSet.iterator();
    while (outElementIterator.hasNext()) {
        String outElementName = (String) outElementIterator.next();
        out = out + outElementName + " " + WSDL2Constants.RPC_RETURN + " ";
    }
    return in + out + inOut;
}

7. Utils#calculateDefaultModuleVersion()

Project: axis2-java
Source File: Utils.java
View license
public static void calculateDefaultModuleVersion(HashMap modules, AxisConfiguration axisConfig) {
    Iterator allModules = modules.values().iterator();
    Map<String, Version> defaultModules = new HashMap<String, Version>();
    while (allModules.hasNext()) {
        AxisModule axisModule = (AxisModule) allModules.next();
        String name = axisModule.getName();
        Version currentDefaultVersion = defaultModules.get(name);
        Version version = axisModule.getVersion();
        if (currentDefaultVersion == null || (version != null && version.compareTo(currentDefaultVersion) > 0)) {
            defaultModules.put(name, version);
        }
    }
    Iterator def_mod_itr = defaultModules.keySet().iterator();
    while (def_mod_itr.hasNext()) {
        String moduleName = (String) def_mod_itr.next();
        Version version = defaultModules.get(moduleName);
        axisConfig.addDefaultModuleVersion(moduleName, version == null ? null : version.toString());
    }
}

8. TinkerGraphTest#compareEdgeCounts()

Project: blueprints
Source File: TinkerGraphTest.java
View license
private void compareEdgeCounts(Vertex v1, Vertex v2, Direction direction) {
    int c1 = 0;
    final Iterator it1 = v1.getEdges(direction).iterator();
    while (it1.hasNext()) {
        it1.next();
        c1++;
    }
    int c2 = 0;
    final Iterator it2 = v2.getEdges(direction).iterator();
    while (it2.hasNext()) {
        it2.next();
        c2++;
    }
    assertEquals(c1, c2);
}

9. ResultSetTest#shouldIterateAndThenThrowIfCallToNextExceedsAvailableResultItems()

Project: tinkerpop
Source File: ResultSetTest.java
View license
@Test
public void shouldIterateAndThenThrowIfCallToNextExceedsAvailableResultItems() throws Exception {
    final Iterator itty = resultSet.iterator();
    addToQueue(3, 1, true, true);
    assertThat(itty.hasNext(), is(true));
    itty.next();
    assertThat(itty.hasNext(), is(true));
    itty.next();
    itty.next();
    assertThat(itty.hasNext(), is(false));
    try {
        itty.next();
        fail("Should throw exception");
    } catch (NoSuchElementException ignore) {
    }
}

10. ImageImplRegistry#discoverClasspathImplementations()

View license
/**
     * Discovers all implementations in the application's classpath.
     */
public void discoverClasspathImplementations() {
    //Dynamic registration of ImagePreloaders
    Iterator iter = Service.providers(ImagePreloader.class);
    while (iter.hasNext()) {
        registerPreloader((ImagePreloader) iter.next());
    }
    //Dynamic registration of ImageLoaderFactories
    iter = Service.providers(ImageLoaderFactory.class);
    while (iter.hasNext()) {
        registerLoaderFactory((ImageLoaderFactory) iter.next());
    }
    //Dynamic registration of ImageConverters
    iter = Service.providers(ImageConverter.class);
    while (iter.hasNext()) {
        registerConverter((ImageConverter) iter.next());
    }
}

11. Changes#execute()

Project: tuscany-das
Source File: Changes.java
View license
/**
     * Execute all my change
     */
public void execute() {
    Iterator i = inserts.getSortedList().iterator();
    while (i.hasNext()) {
        ChangeOperation c = (ChangeOperation) i.next();
        c.execute();
    }
    i = updates.getSortedList().iterator();
    while (i.hasNext()) {
        ChangeOperation c = (ChangeOperation) i.next();
        c.execute();
    }
    i = deletes.getSortedList().iterator();
    while (i.hasNext()) {
        ChangeOperation c = (ChangeOperation) i.next();
        c.execute();
    }
}

12. ForceSimulator#accumulate()

Project: Prefuse
Source File: ForceSimulator.java
View license
/**
     * Accumulate all forces acting on the items in this simulation
     */
public void accumulate() {
    for (int i = 0; i < iflen; i++) iforces[i].init(this);
    for (int i = 0; i < sflen; i++) sforces[i].init(this);
    Iterator itemIter = items.iterator();
    while (itemIter.hasNext()) {
        ForceItem item = (ForceItem) itemIter.next();
        item.force[0] = 0.0f;
        item.force[1] = 0.0f;
        for (int i = 0; i < iflen; i++) iforces[i].getForce(item);
    }
    Iterator springIter = springs.iterator();
    while (springIter.hasNext()) {
        Spring s = (Spring) springIter.next();
        for (int i = 0; i < sflen; i++) {
            sforces[i].getForce(s);
        }
    }
}

13. GraphTest#testRemoveNode()

Project: Prefuse
Source File: GraphTest.java
View license
public void testRemoveNode() {
    int cliqueSize = 5;
    Graph g = GraphLib.getClique(cliqueSize);
    Edge[] edges = new Edge[4];
    Node rem = (Node) g.nodes().next();
    Iterator it = rem.edges();
    for (int i = 0; it.hasNext(); ++i) {
        edges[i] = (Edge) it.next();
    }
    assertEquals(true, g.removeNode(rem));
    assertEquals(false, rem.isValid());
    Iterator nodes = g.nodes();
    while (nodes.hasNext()) {
        assertEquals(cliqueSize - 2, ((Node) nodes.next()).getDegree());
    }
    for (int i = 0; i < edges.length; ++i) {
        assertEquals(false, edges[i].isValid());
    }
}

14. PNGImageWriter#write_zTXt()

Project: jdk7u-jdk
Source File: PNGImageWriter.java
View license
private void write_zTXt() throws IOException {
    Iterator keywordIter = metadata.zTXt_keyword.iterator();
    Iterator methodIter = metadata.zTXt_compressionMethod.iterator();
    Iterator textIter = metadata.zTXt_text.iterator();
    while (keywordIter.hasNext()) {
        ChunkStream cs = new ChunkStream(PNGImageReader.zTXt_TYPE, stream);
        String keyword = (String) keywordIter.next();
        cs.writeBytes(keyword);
        cs.writeByte(0);
        int compressionMethod = ((Integer) methodIter.next()).intValue();
        cs.writeByte(compressionMethod);
        String text = (String) textIter.next();
        cs.write(deflate(text.getBytes("ISO-8859-1")));
        cs.finish();
    }
}

15. TestOrganizationalUnits#assertOrgUnitResources()

View license
/**
     * Returns the list of associated resource root paths.<p>
     *
     * @param cms the cms context
     * @param ou the organizational unit to get the resources for
     *
     * @throws CmsException if something goes wrong
     */
private void assertOrgUnitResources(CmsObject cms, CmsOrganizationalUnit ou) throws CmsException {
    List resourceList = new ArrayList();
    Iterator itResources = OpenCms.getOrgUnitManager().getResourcesForOrganizationalUnit(cms, ou.getName()).iterator();
    while (itResources.hasNext()) {
        CmsResource resource = (CmsResource) itResources.next();
        resourceList.add(resource.getRootPath());
    }
    List relations = cms.getRelationsForResource(cms.getSitePath(cms.readResource(ou.getId())), CmsRelationFilter.TARGETS);
    assertEquals(relations.size(), resourceList.size());
    Iterator itRelations = relations.iterator();
    while (itRelations.hasNext()) {
        CmsRelation relation = (CmsRelation) itRelations.next();
        assertTrue(resourceList.contains(relation.getTargetPath()));
    }
}

16. PrefsBean#validateEventList()

Project: sakai
Source File: PrefsBean.java
View license
/**
	 * Foreach 'list' entry A, remove it from 'temp'. If A doesn't exist in 'temp', remove it from 'list'. 
	 * @param list A event priority List.
	 * @param temp A List with all events.
	 */
private static PairList validateEventList(PairList lists) {
    List temp = lists.tempList;
    List list = lists.dataList;
    if (list == null) {
        return lists;
    }
    List toRemoveFromList = new ArrayList();
    Iterator iL = list.iterator();
    while (iL.hasNext()) {
        Object e = iL.next();
        if (temp.contains(e))
            temp.remove(e);
        else
            toRemoveFromList.add(e);
    }
    Iterator iR = toRemoveFromList.iterator();
    while (iR.hasNext()) {
        Object e = iR.next();
        list.remove(e);
    }
    lists.dataList = list;
    lists.tempList = temp;
    return lists;
}

17. ActionMessages#properties()

Project: sonarqube
Source File: ActionMessages.java
View license
/**
     * <p>Return the set of property names for which at least one message has
     * been recorded. If there are no messages, an empty <code>Iterator</code>
     * is returned. If you have recorded global messages, the
     * <code>String</code> value of <code>ActionMessages.GLOBAL_MESSAGE</code>
     * will be one of the returned property names.</p>
     *
     * @return An iterator over the property names for which messages exist.
     */
public Iterator properties() {
    if (messages.isEmpty()) {
        return Collections.EMPTY_LIST.iterator();
    }
    ArrayList results = new ArrayList();
    ArrayList actionItems = new ArrayList();
    for (Iterator i = messages.values().iterator(); i.hasNext(); ) {
        actionItems.add(i.next());
    }
    // Sort ActionMessageItems based on the initial order the
    // property/key was added to ActionMessages.
    Collections.sort(actionItems, ACTION_ITEM_COMPARATOR);
    for (Iterator i = actionItems.iterator(); i.hasNext(); ) {
        ActionMessageItem ami = (ActionMessageItem) i.next();
        results.add(ami.getProperty());
    }
    return results.iterator();
}

18. LeaseRenewalManager#canBatch()

Project: river
Source File: LeaseRenewalManager.java
View license
/**
     * Return true if e can be batched with another entry that expires
     * between e.renew - renewBatchTimeWindow and e.renew.
     */
private boolean canBatch(Entry e) {
    Iterator iter = leases.tailMap(e).values().iterator();
    // skip e itself
    iter.next();
    while (iter.hasNext()) {
        Entry be = (Entry) iter.next();
        if (e.renew - be.renew > renewBatchTimeWindow)
            break;
        if (e.canBatch(be))
            return true;
    }
    return false;
}

19. LookupLocatorDiscovery#getLocators()

Project: river
Source File: LookupLocatorDiscovery.java
View license
//end terminate
/**
     * Returns an array consisting of the elements of the managed set
     * of locators; that is, instances of <code>LookupLocator</code> in
     * which each instance corresponds to a specific lookup service to
     * discover. The returned set will include both the set of 
     * <code>LookupLocator</code>s corresponding to lookup services 
     * that have already been discovered as well as the set of those
     * that have not yet been discovered. If the managed set of locators
     * is empty, this method will return the empty array. This method
     * returns a new array upon each invocation.
     *
     * @return <code>LookupLocator</code> array consisting of the elements
     *         of the managed set of locators
     *
     * @throws java.lang.IllegalStateException this exception occurs when
     *         this method is called after the <code>terminate</code>
     *         method has been called.
     * 
     * @see net.jini.discovery.DiscoveryLocatorManagement#getLocators
     * @see #setLocators
     */
public synchronized LookupLocator[] getLocators() {
    if (terminated) {
        throw new IllegalStateException("discovery terminated");
    }
    /* Includes the set of already-discovered lookup services and
         * the set of not-yet-discovered lookup services.
         */
    int size = discoveredLocators.size() + undiscoveredLocators.size();
    LookupLocator[] ret = new LookupLocator[size];
    /* Retrieve the locators of the already-discovered lookup services */
    int k = 0;
    Iterator iter = discoveredLocators.iterator();
    while (iter.hasNext()) {
        ret[k++] = ((LocatorReg) iter.next()).l;
    }
    //end loop
    /* Append the locators of the not-yet-discovered lookup services */
    iter = undiscoveredLocators.iterator();
    while (iter.hasNext()) {
        ret[k++] = ((LocatorReg) iter.next()).l;
    }
    //end loop
    return ret;
}

20. X500Constraints#checkServerPrincipal()

Project: river
Source File: X500Constraints.java
View license
/**
     * Checks the given server principal against the constraints represented by
     * this instance, returning the number of preferences satisfied, or -1 if
     * the constraint requirements are not satisfied by the principal.
     */
int checkServerPrincipal(X500Principal principal) {
    for (Iterator i = distilled.requirements().iterator(); i.hasNext(); ) {
        if (!serverPrincipalSatisfies(principal, (InvocationConstraint) i.next())) {
            return -1;
        }
    }
    int satisfied = 0;
    for (Iterator i = distilled.preferences().iterator(); i.hasNext(); ) {
        if (serverPrincipalSatisfies(principal, (InvocationConstraint) i.next())) {
            satisfied++;
        }
    }
    return satisfied;
}

21. X500Constraints#checkClientPrincipal()

Project: river
Source File: X500Constraints.java
View license
/**
     * Checks the given client principal against the constraints represented by
     * this instance, returning the number of preferences satisfied, or -1 if
     * the constraint requirements are not satisfied by the principal.
     */
int checkClientPrincipal(X500Principal principal) {
    for (Iterator i = distilled.requirements().iterator(); i.hasNext(); ) {
        if (!clientPrincipalSatisfies(principal, (InvocationConstraint) i.next())) {
            return -1;
        }
    }
    int satisfied = 0;
    for (Iterator i = distilled.preferences().iterator(); i.hasNext(); ) {
        if (clientPrincipalSatisfies(principal, (InvocationConstraint) i.next())) {
            satisfied++;
        }
    }
    return satisfied;
}

22. TimeslotWrapper#removeAttendee()

Project: sakai
Source File: TimeslotWrapper.java
View license
/**
	 * This method performs removing attendee from current time slot.
	 * 
	 * @param attendeeUserId
	 *            a unique sakai internal user id.
	 */
public void removeAttendee(String attendeeUserId) {
    if (attendeeWrappers == null)
        return;
    for (Iterator iter = attendeeWrappers.iterator(); iter.hasNext(); ) {
        AttendeeWrapper attendeeWrapper = (AttendeeWrapper) iter.next();
        if (attendeeWrapper.getSignupAttendee().getAttendeeUserId().equals(attendeeUserId)) {
            iter.remove();
            break;
        }
    }
    List<SignupAttendee> attendees = timeSlot.getAttendees();
    for (Iterator iter = attendees.iterator(); iter.hasNext(); ) {
        SignupAttendee attendee = (SignupAttendee) iter.next();
        if (attendee.getAttendeeUserId().equals(attendeeUserId)) {
            iter.remove();
            break;
        }
    }
    updatePositionIndex(attendeeWrappers);
}

23. DivMessagesRenderer#getComponentBoundMessages()

Project: sakai
Source File: DivMessagesRenderer.java
View license
/**
     * Finds the non-global messages
     *
	 * @param allFacesMessages
	 * @param globalFacesMessages
	 * @return
	 */
private Collection getComponentBoundMessages(Iterator allFacesMessages, Iterator globalFacesMessages) {
    List allFacesMessagesList = new ArrayList();
    for (Iterator msgs = allFacesMessages; msgs.hasNext(); ) {
        allFacesMessagesList.add(msgs.next());
    }
    List globalFacesMessagesList = new ArrayList();
    for (Iterator msgs = globalFacesMessages; msgs.hasNext(); ) {
        globalFacesMessagesList.add(msgs.next());
    }
    allFacesMessagesList.removeAll(globalFacesMessagesList);
    if (logger.isDebugEnabled())
        logger.debug(allFacesMessagesList.size() + " component bound messages");
    return allFacesMessagesList;
}

24. SiteContentProducer#getAction()

Project: sakai
Source File: SiteContentProducer.java
View license
/*
	 * (non-Javadoc)
	 * 
	 * @see org.sakaiproject.search.api.EntityContentProducer#getAction(org.sakaiproject.event.api.Event)
	 */
public Integer getAction(Event event) {
    String evt = event.getEvent();
    if (evt == null)
        return SearchBuilderItem.ACTION_UNKNOWN;
    for (Iterator i = addEvents.iterator(); i.hasNext(); ) {
        String match = (String) i.next();
        if (evt.equals(match)) {
            return SearchBuilderItem.ACTION_ADD;
        }
    }
    for (Iterator i = removeEvents.iterator(); i.hasNext(); ) {
        String match = (String) i.next();
        if (evt.equals(match)) {
            return SearchBuilderItem.ACTION_DELETE;
        }
    }
    return SearchBuilderItem.ACTION_UNKNOWN;
}

25. MessageForumsEntityContentProducer#getAction()

View license
public Integer getAction(Event event) {
    String evt = event.getEvent();
    if (evt == null)
        return SearchBuilderItem.ACTION_UNKNOWN;
    for (Iterator i = addEvents.iterator(); i.hasNext(); ) {
        String match = (String) i.next();
        if (evt.equals(match)) {
            return SearchBuilderItem.ACTION_ADD;
        }
    }
    for (Iterator i = removeEvents.iterator(); i.hasNext(); ) {
        String match = (String) i.next();
        if (evt.equals(match)) {
            return SearchBuilderItem.ACTION_DELETE;
        }
    }
    return SearchBuilderItem.ACTION_UNKNOWN;
}

26. MessageContentProducer#getAction()

Project: sakai
Source File: MessageContentProducer.java
View license
/**
	 * @{inheritDoc}
	 */
public Integer getAction(Event event) {
    String evt = event.getEvent();
    if (evt == null)
        return SearchBuilderItem.ACTION_UNKNOWN;
    for (Iterator i = addEvents.iterator(); i.hasNext(); ) {
        String match = (String) i.next();
        if (evt.equals(match)) {
            return SearchBuilderItem.ACTION_ADD;
        }
    }
    for (Iterator i = removeEvents.iterator(); i.hasNext(); ) {
        String match = (String) i.next();
        if (evt.equals(match)) {
            return SearchBuilderItem.ACTION_DELETE;
        }
    }
    return SearchBuilderItem.ACTION_UNKNOWN;
}

27. Reflector#_clean()

Project: railo
Source File: Reflector.java
View license
private static Object _clean(Set<Object> done, List list) {
    Iterator it = list.iterator();
    Object v;
    boolean change = false;
    while (it.hasNext()) {
        v = it.next();
        if (v != _clean(done, v)) {
            change = true;
            break;
        }
    }
    if (!change)
        return list;
    list = Duplicator.duplicateList(list, false);
    it = list.iterator();
    while (it.hasNext()) {
        list.add(_clean(done, it.next()));
    }
    return list;
}

28. Balancer#emitOpenWithRemembered()

Project: sakai
Source File: Balancer.java
View license
private void emitOpenWithRemembered() {
    // Append the opens to sb
    for (Iterator it = rememberedStack.iterator(); it.hasNext(); ) {
        Tag tag = (Tag) it.next();
        sb.append(tag.open);
    }
    // Create replacement string
    StringBuffer buffer = new StringBuffer();
    for (Iterator it = rememberedStack.backIterator(); it.hasNext(); ) {
        Tag tag = (Tag) it.next();
        buffer.append("</").append(tag.name).append(">");
    }
    buffer.append(m.group(1).replaceAll("\\\\", "\\\\\\\\").replaceAll("\\$", "\\\\\\$"));
    m.appendReplacement(sb, buffer.toString());
}

29. Balancer#emitCloseWithRemembered()

Project: sakai
Source File: Balancer.java
View license
private void emitCloseWithRemembered() {
    // OPEN the remembered tags
    for (Iterator it = rememberedStack.iterator(); it.hasNext(); ) {
        Tag tag = (Tag) it.next();
        sb.append(tag.open);
    }
    // Create replacement string
    StringBuffer replacementBuffer = new StringBuffer();
    for (Iterator it = rememberedStack.backIterator(); it.hasNext(); ) {
        Tag tag = (Tag) it.next();
        replacementBuffer.append("</").append(tag.name).append(">");
    }
    doClosing(replacementBuffer);
}

30. DivMessagesRenderer#getComponentBoundMessages()

Project: sakai
Source File: DivMessagesRenderer.java
View license
/**
     * Finds the non-global messages
     *
	 * @param allFacesMessages
	 * @param globalFacesMessages
	 * @return
	 */
private Collection getComponentBoundMessages(Iterator allFacesMessages, Iterator globalFacesMessages) {
    List allFacesMessagesList = new ArrayList();
    for (Iterator msgs = allFacesMessages; msgs.hasNext(); ) {
        allFacesMessagesList.add(msgs.next());
    }
    List globalFacesMessagesList = new ArrayList();
    for (Iterator msgs = globalFacesMessages; msgs.hasNext(); ) {
        globalFacesMessagesList.add(msgs.next());
    }
    allFacesMessagesList.removeAll(globalFacesMessagesList);
    if (logger.isDebugEnabled())
        logger.debug(allFacesMessagesList.size() + " component bound messages");
    return allFacesMessagesList;
}

31. GradebookManagerHibernateImpl#filterAndPopulateCourseGradeRecordsByStudents()

View license
protected List filterAndPopulateCourseGradeRecordsByStudents(CourseGrade courseGrade, Collection gradeRecords, Collection studentUids) {
    List filteredRecords = new ArrayList();
    Set missingStudents = new HashSet(studentUids);
    for (Iterator iter = gradeRecords.iterator(); iter.hasNext(); ) {
        CourseGradeRecord cgr = (CourseGradeRecord) iter.next();
        if (studentUids.contains(cgr.getStudentId())) {
            filteredRecords.add(cgr);
            missingStudents.remove(cgr.getStudentId());
        }
    }
    for (Iterator iter = missingStudents.iterator(); iter.hasNext(); ) {
        String studentUid = (String) iter.next();
        CourseGradeRecord cgr = new CourseGradeRecord(courseGrade, studentUid);
        filteredRecords.add(cgr);
    }
    return filteredRecords;
}

32. GradebookServiceHibernateImpl#filterAndPopulateCourseGradeRecordsByStudents()

View license
@SuppressWarnings({ "unchecked", "rawtypes" })
private List filterAndPopulateCourseGradeRecordsByStudents(CourseGrade courseGrade, Collection gradeRecords, Collection studentUids) {
    List filteredRecords = new ArrayList();
    Set missingStudents = new HashSet(studentUids);
    for (Iterator iter = gradeRecords.iterator(); iter.hasNext(); ) {
        CourseGradeRecord cgr = (CourseGradeRecord) iter.next();
        if (studentUids.contains(cgr.getStudentId())) {
            filteredRecords.add(cgr);
            missingStudents.remove(cgr.getStudentId());
        }
    }
    for (Iterator iter = missingStudents.iterator(); iter.hasNext(); ) {
        String studentUid = (String) iter.next();
        CourseGradeRecord cgr = new CourseGradeRecord(courseGrade, studentUid);
        filteredRecords.add(cgr);
    }
    return filteredRecords;
}

33. CmSynchronizer#reconcileEnrollments()

Project: sakai
Source File: CmSynchronizer.java
View license
protected void reconcileEnrollments(Element enrollmentsElement, EnrollmentSet enrollmentSet) {
    List newEnrollmentElements = enrollmentsElement.getChildren("enrollment");
    Set newUserEids = new HashSet();
    Set existingEnrollments = cmService.getEnrollments(enrollmentSet.getEid());
    for (Iterator iter = newEnrollmentElements.iterator(); iter.hasNext(); ) {
        Element enrollmentElement = (Element) iter.next();
        String userEid = enrollmentElement.getChildText("userEid");
        newUserEids.add(userEid);
        String status = enrollmentElement.getChildText("status");
        String credits = enrollmentElement.getChildText("credits");
        String gradingScheme = enrollmentElement.getChildText("grading-scheme");
        cmAdmin.addOrUpdateEnrollment(userEid, enrollmentSet.getEid(), status, credits, gradingScheme);
    }
    for (Iterator iter = existingEnrollments.iterator(); iter.hasNext(); ) {
        Enrollment existingEnr = (Enrollment) iter.next();
        if (!newUserEids.contains(existingEnr.getUserId())) {
            // Drop this enrollment
            cmAdmin.removeEnrollment(existingEnr.getUserId(), enrollmentSet.getEid());
        }
    }
}

34. ChatContentProducer#getAction()

Project: sakai
Source File: ChatContentProducer.java
View license
/**
    * {@inheritDoc}
    */
public Integer getAction(Event event) {
    String evt = event.getEvent();
    if (evt == null)
        return SearchBuilderItem.ACTION_UNKNOWN;
    for (Iterator i = addEvents.iterator(); i.hasNext(); ) {
        String match = (String) i.next();
        if (evt.equals(match)) {
            return SearchBuilderItem.ACTION_ADD;
        }
    }
    for (Iterator i = removeEvents.iterator(); i.hasNext(); ) {
        String match = (String) i.next();
        if (evt.equals(match)) {
            return SearchBuilderItem.ACTION_DELETE;
        }
    }
    return SearchBuilderItem.ACTION_UNKNOWN;
}

35. ResourceManager#dispose()

Project: Terraria-Clone
Source File: ResourceManager.java
View license
public void dispose() {
    Iterator it = textures.entrySet().iterator();
    while (it.hasNext()) {
        Map.Entry pair = (Map.Entry) it.next();
        ((Texture) pair.getValue()).dispose();
        // avoids a ConcurrentModificationException
        it.remove();
    }
    it = fonts.entrySet().iterator();
    while (it.hasNext()) {
        Map.Entry pair = (Map.Entry) it.next();
        ((BitmapFont) pair.getValue()).dispose();
        // avoids a ConcurrentModificationException
        it.remove();
    }
}

36. FieldTracker#setFocusToFirstInvalidField()

View license
public synchronized boolean setFocusToFirstInvalidField() {
    for (final Iterator it = insertionOrder.iterator(); it.hasNext(); ) {
        final Field field = (Field) it.next();
        if (field.getStatus() != FieldStatus.VALID) {
            final FieldInfo fieldInfo = (FieldInfo) fields.get(field);
            if (fieldInfo.focusReceiver != null) {
                if (fieldInfo.focusReceiver.setFocus()) {
                    return true;
                }
            }
        }
    }
    for (final Iterator it = children.iterator(); it.hasNext(); ) {
        final FieldTracker child = (FieldTracker) it.next();
        if (child.setFocusToFirstInvalidField()) {
            return true;
        }
    }
    return false;
}

37. FieldTracker#findFirstInvalidField()

View license
public synchronized Field findFirstInvalidField() {
    for (final Iterator it = insertionOrder.iterator(); it.hasNext(); ) {
        final Field field = (Field) it.next();
        if (field.getStatus() != FieldStatus.VALID) {
            return field;
        }
    }
    for (final Iterator it = children.iterator(); it.hasNext(); ) {
        final FieldTracker child = (FieldTracker) it.next();
        final Field field = child.findFirstInvalidField();
        if (field != null) {
            return field;
        }
    }
    return null;
}

38. EncodingMap#completeMappings()

Project: xmlbeans
Source File: EncodingMap.java
View license
private static final boolean completeMappings() {
    HashMap m = new HashMap();
    for (Iterator i = _iana_to_java.keySet().iterator(); i.hasNext(); ) m.put(_iana_to_java.get(i.next()), null);
    for (Iterator i = m.keySet().iterator(); i.hasNext(); ) {
        Object k = i.next();
        assert _java_to_iana.containsKey(k) : k;
    }
    return true;
}

39. ServiceTestCase#testWithClassNames()

View license
/**
     * Tests the mode where Service returns class names.
     * @throws Exception in case of an error
     */
@Test
public void testWithClassNames() throws Exception {
    Class cls = ImageWriter.class;
    boolean found = true;
    Iterator iter = Service.providerNames(cls);
    while (iter.hasNext()) {
        Object obj = iter.next();
        assertNotNull(obj);
        assertTrue("Returned object must be a class name", obj instanceof String);
        if ("org.apache.xmlgraphics.image.writer.internal.PNGImageWriter".equals(obj) || ("org.apache.xmlgraphics.image.writer.imageio.ImageIOPNGImageWriter".equals(obj))) {
            found = true;
        }
    }
    assertTrue("None of the expected classes found", found);
    //Do it a second time to make sure the cache works as expected
    iter = Service.providerNames(cls);
    while (iter.hasNext()) {
        Object obj = iter.next();
        assertNotNull(obj);
        assertTrue("Returned object must be a class name", obj instanceof String);
    }
}

40. ReferenceIndividualGroupService#synchronizeGroupMembersOnUpdate()

View license
/**
 * Adjust the back pointers of the updated group members to either add or remove
 * the parent group.  Then update the cache to invalidate copies on peer servers.
 *
 * @param group ILockableEntityGroup
 */
protected void synchronizeGroupMembersOnUpdate(IEntityGroup group) throws GroupsException {
    EntityGroupImpl egi = (EntityGroupImpl) group;
    GroupMemberImpl gmi = null;
    for (Iterator it = egi.getAddedMembers().values().iterator(); it.hasNext(); ) {
        gmi = (GroupMemberImpl) it.next();
        gmi.invalidateInParentGroupsCache(Collections.singleton((IGroupMember) gmi));
        if (cacheInUse()) {
            cacheUpdate(gmi);
        }
    }
    for (Iterator it = egi.getRemovedMembers().values().iterator(); it.hasNext(); ) {
        gmi = (GroupMemberImpl) it.next();
        gmi.invalidateInParentGroupsCache(Collections.singleton((IGroupMember) gmi));
        if (cacheInUse()) {
            cacheUpdate(gmi);
        }
    }
}

41. ReferenceIndividualGroupService#findMembers()

View license
/**
 * Returns and members for the <code>IEntityGroup</code>.
 * @param eg IEntityGroup
 */
public Iterator findMembers(IEntityGroup eg) throws GroupsException {
    Collection members = new ArrayList(10);
    Iterator it = null;
    for (it = findMemberGroups(eg); it.hasNext(); ) {
        members.add(it.next());
    }
    for (it = findMemberEntities(eg); it.hasNext(); ) {
        members.add(it.next());
    }
    return members.iterator();
}

42. MessageUtil#transfer()

Project: servicemix-utils
Source File: MessageUtil.java
View license
public static void transfer(NormalizedMessage source, NormalizedMessage dest) throws MessagingException {
    dest.setContent(source.getContent());
    for (Iterator it = source.getPropertyNames().iterator(); it.hasNext(); ) {
        String name = (String) it.next();
        dest.setProperty(name, source.getProperty(name));
    }
    for (Iterator it = source.getAttachmentNames().iterator(); it.hasNext(); ) {
        String name = (String) it.next();
        dest.addAttachment(name, source.getAttachment(name));
    }
    dest.setSecuritySubject(source.getSecuritySubject());
}

43. AbstractXMLReaderTest#testExposesAttributesKeysAsIterator()

Project: xstream
Source File: AbstractXMLReaderTest.java
View license
public void testExposesAttributesKeysAsIterator() throws Exception {
    HierarchicalStreamReader xmlReader = createReader("<node hello='world' a='b' c='d'><empty/></node>");
    Set expected = new HashSet();
    expected.add("hello");
    expected.add("a");
    expected.add("c");
    Set actual = new HashSet();
    Iterator iterator;
    iterator = xmlReader.getAttributeNames();
    while (iterator.hasNext()) {
        actual.add(iterator.next());
    }
    assertEquals(expected, actual);
    // again, to check iteration is repeatable 
    iterator = xmlReader.getAttributeNames();
    while (iterator.hasNext()) {
        actual.add(iterator.next());
    }
    assertEquals(expected, actual);
}

44. SDOHelperImpl#registerDataGraphTypes()

Project: tuscany-sdo
Source File: SDOHelperImpl.java
View license
public void registerDataGraphTypes(DataGraph dataGraph, List /* Type */
types) {
    // if (types == null)
    // types = SDOUtil.getDataGraphTypes(dataGraph);
    Set /* EPackage */
    packages = new HashSet();
    for (final Iterator iterator = types.iterator(); iterator.hasNext(); ) {
        EClassifier type = (EClassifier) iterator.next();
        packages.add(type.getEPackage());
    }
    ResourceSet resourceSet = ((DataGraphImpl) dataGraph).getResourceSet();
    for (Iterator iterator = packages.iterator(); iterator.hasNext(); ) {
        EPackage typePackage = (EPackage) iterator.next();
        Resource resource = typePackage.eResource();
        if (resource == null) {
            resource = resourceSet.createResource(URI.createURI(".ecore"));
            resource.setURI(URI.createURI(typePackage.getNsURI()));
            resource.getContents().add(typePackage);
        } else if (resource.getResourceSet() != resourceSet)
            resourceSet.getResources().add(resource);
    }
}

45. CopyHelperImpl#copy()

Project: tuscany-sdo
Source File: CopyHelperImpl.java
View license
public EObject copy(EObject object) {
    EObject result = super.copy(object);
    copyReferences();
    for (Iterator csit = csToTurnOn.iterator(); csit.hasNext(); ) {
        ChangeSummary cs = (ChangeSummary) csit.next();
        if (!cs.isLogging()) {
            cs.beginLogging();
        }
    }
    for (Iterator csit = csToTurnOff.iterator(); csit.hasNext(); ) {
        ChangeSummary cs = (ChangeSummary) csit.next();
        if (cs.isLogging()) {
            cs.endLogging();
        }
    }
    return result;
}

46. GraphMerger#merge()

Project: tuscany-das
Source File: GraphMerger.java
View license
public DataObject merge(List graphs) {
    DataObject primaryGraph = (DataObject) graphs.get(0);
    Iterator i = graphs.iterator();
    if (i.hasNext()) {
        i.next();
    }
    while (i.hasNext()) {
        primaryGraph = merge(primaryGraph, (DataObject) i.next());
    }
    return primaryGraph;
}

47. TreeSubSetTest#testIteratorRemove()

Project: openjdk
Source File: TreeSubSetTest.java
View license
/**
     * iterator.remove removes current element
     */
public void testIteratorRemove() {
    final NavigableSet q = set0();
    q.add(new Integer(2));
    q.add(new Integer(1));
    q.add(new Integer(3));
    Iterator it = q.iterator();
    it.next();
    it.remove();
    it = q.iterator();
    assertEquals(2, it.next());
    assertEquals(3, it.next());
    assertFalse(it.hasNext());
}

48. TreeSetTest#testIteratorRemove()

Project: openjdk
Source File: TreeSetTest.java
View license
/**
     * iterator.remove removes current element
     */
public void testIteratorRemove() {
    final TreeSet q = new TreeSet();
    q.add(new Integer(2));
    q.add(new Integer(1));
    q.add(new Integer(3));
    Iterator it = q.iterator();
    it.next();
    it.remove();
    it = q.iterator();
    assertEquals(it.next(), new Integer(2));
    assertEquals(it.next(), new Integer(3));
    assertFalse(it.hasNext());
}

49. PriorityQueueTest#testIteratorRemove()

Project: openjdk
Source File: PriorityQueueTest.java
View license
/**
     * iterator.remove removes current element
     */
public void testIteratorRemove() {
    final PriorityQueue q = new PriorityQueue(3);
    q.add(new Integer(2));
    q.add(new Integer(1));
    q.add(new Integer(3));
    Iterator it = q.iterator();
    it.next();
    it.remove();
    it = q.iterator();
    assertEquals(it.next(), new Integer(2));
    assertEquals(it.next(), new Integer(3));
    assertFalse(it.hasNext());
}

50. PriorityBlockingQueueTest#testIteratorRemove()

View license
/**
     * iterator.remove removes current element
     */
public void testIteratorRemove() {
    final PriorityBlockingQueue q = new PriorityBlockingQueue(3);
    q.add(new Integer(2));
    q.add(new Integer(1));
    q.add(new Integer(3));
    Iterator it = q.iterator();
    it.next();
    it.remove();
    it = q.iterator();
    assertEquals(it.next(), new Integer(2));
    assertEquals(it.next(), new Integer(3));
    assertFalse(it.hasNext());
}

51. LinkedTransferQueueTest#testIteratorRemove()

View license
/**
     * iterator.remove() removes current element
     */
public void testIteratorRemove() {
    final LinkedTransferQueue q = new LinkedTransferQueue();
    q.add(two);
    q.add(one);
    q.add(three);
    Iterator it = q.iterator();
    it.next();
    it.remove();
    it = q.iterator();
    assertSame(it.next(), one);
    assertSame(it.next(), three);
    assertFalse(it.hasNext());
}

52. LinkedTransferQueueTest#testIterator()

View license
/**
     * iterator iterates through all elements
     */
public void testIterator() throws InterruptedException {
    LinkedTransferQueue q = populatedQueue(SIZE);
    Iterator it = q.iterator();
    int i;
    for (i = 0; it.hasNext(); i++) assertTrue(q.contains(it.next()));
    assertEquals(i, SIZE);
    assertIteratorExhausted(it);
    it = q.iterator();
    for (i = 0; it.hasNext(); i++) assertEquals(it.next(), q.take());
    assertEquals(i, SIZE);
    assertIteratorExhausted(it);
}

53. LinkedListTest#testDescendingIteratorRemove()

Project: openjdk
Source File: LinkedListTest.java
View license
/**
     * descendingIterator.remove removes current element
     */
public void testDescendingIteratorRemove() {
    final LinkedList q = new LinkedList();
    q.add(three);
    q.add(two);
    q.add(one);
    Iterator it = q.descendingIterator();
    it.next();
    it.remove();
    it = q.descendingIterator();
    assertSame(it.next(), two);
    assertSame(it.next(), three);
    assertFalse(it.hasNext());
}

54. LinkedBlockingQueueTest#testIteratorRemove()

View license
/**
     * iterator.remove removes current element
     */
public void testIteratorRemove() {
    final LinkedBlockingQueue q = new LinkedBlockingQueue(3);
    q.add(two);
    q.add(one);
    q.add(three);
    Iterator it = q.iterator();
    it.next();
    it.remove();
    it = q.iterator();
    assertSame(it.next(), one);
    assertSame(it.next(), three);
    assertFalse(it.hasNext());
}

55. LinkedBlockingQueueTest#testIterator()

View license
/**
     * iterator iterates through all elements
     */
public void testIterator() throws InterruptedException {
    LinkedBlockingQueue q = populatedQueue(SIZE);
    Iterator it = q.iterator();
    int i;
    for (i = 0; it.hasNext(); i++) assertTrue(q.contains(it.next()));
    assertEquals(i, SIZE);
    assertIteratorExhausted(it);
    it = q.iterator();
    for (i = 0; it.hasNext(); i++) assertEquals(it.next(), q.take());
    assertEquals(i, SIZE);
    assertIteratorExhausted(it);
}

56. LinkedBlockingDequeTest#testIteratorRemove()

View license
/**
     * iterator.remove removes current element
     */
public void testIteratorRemove() {
    final LinkedBlockingDeque q = new LinkedBlockingDeque(3);
    q.add(two);
    q.add(one);
    q.add(three);
    Iterator it = q.iterator();
    it.next();
    it.remove();
    it = q.iterator();
    assertSame(it.next(), one);
    assertSame(it.next(), three);
    assertFalse(it.hasNext());
}

57. LinkedBlockingDequeTest#testIterator()

View license
/**
     * iterator iterates through all elements
     */
public void testIterator() throws InterruptedException {
    LinkedBlockingDeque q = populatedDeque(SIZE);
    Iterator it = q.iterator();
    int i;
    for (i = 0; it.hasNext(); i++) assertTrue(q.contains(it.next()));
    assertEquals(i, SIZE);
    assertIteratorExhausted(it);
    it = q.iterator();
    for (i = 0; it.hasNext(); i++) assertEquals(it.next(), q.take());
    assertEquals(i, SIZE);
    assertIteratorExhausted(it);
}

58. DelayQueueTest#testIteratorRemove()

Project: openjdk
Source File: DelayQueueTest.java
View license
/**
     * iterator.remove removes current element
     */
public void testIteratorRemove() {
    final DelayQueue q = new DelayQueue();
    q.add(new PDelay(2));
    q.add(new PDelay(1));
    q.add(new PDelay(3));
    Iterator it = q.iterator();
    it.next();
    it.remove();
    it = q.iterator();
    assertEquals(new PDelay(2), it.next());
    assertEquals(new PDelay(3), it.next());
    assertFalse(it.hasNext());
}

59. ConcurrentSkipListSubSetTest#testDescendingIteratorRemove()

View license
/**
     * iterator.remove removes current element
     */
public void testDescendingIteratorRemove() {
    final NavigableSet q = dset0();
    q.add(new Integer(2));
    q.add(new Integer(1));
    q.add(new Integer(3));
    Iterator it = q.iterator();
    it.next();
    it.remove();
    it = q.iterator();
    assertEquals(it.next(), new Integer(2));
    assertEquals(it.next(), new Integer(3));
    assertFalse(it.hasNext());
}

60. ConcurrentSkipListSubSetTest#testIteratorRemove()

View license
/**
     * iterator.remove removes current element
     */
public void testIteratorRemove() {
    final NavigableSet q = set0();
    q.add(new Integer(2));
    q.add(new Integer(1));
    q.add(new Integer(3));
    Iterator it = q.iterator();
    it.next();
    it.remove();
    it = q.iterator();
    assertEquals(it.next(), new Integer(2));
    assertEquals(it.next(), new Integer(3));
    assertFalse(it.hasNext());
}

61. ConcurrentSkipListSetTest#testIteratorRemove()

View license
/**
     * iterator.remove removes current element
     */
public void testIteratorRemove() {
    final ConcurrentSkipListSet q = new ConcurrentSkipListSet();
    q.add(new Integer(2));
    q.add(new Integer(1));
    q.add(new Integer(3));
    Iterator it = q.iterator();
    it.next();
    it.remove();
    it = q.iterator();
    assertEquals(it.next(), new Integer(2));
    assertEquals(it.next(), new Integer(3));
    assertFalse(it.hasNext());
}

62. ConcurrentLinkedQueueTest#testIteratorRemove()

View license
/**
     * iterator.remove removes current element
     */
public void testIteratorRemove() {
    final ConcurrentLinkedQueue q = new ConcurrentLinkedQueue();
    q.add(one);
    q.add(two);
    q.add(three);
    Iterator it = q.iterator();
    it.next();
    it.remove();
    it = q.iterator();
    assertSame(it.next(), two);
    assertSame(it.next(), three);
    assertFalse(it.hasNext());
}

63. ArrayBlockingQueueTest#testIteratorRemove()

Project: openjdk
Source File: ArrayBlockingQueueTest.java
View license
/**
     * iterator.remove removes current element
     */
public void testIteratorRemove() {
    final ArrayBlockingQueue q = new ArrayBlockingQueue(3);
    q.add(two);
    q.add(one);
    q.add(three);
    Iterator it = q.iterator();
    it.next();
    it.remove();
    it = q.iterator();
    assertSame(it.next(), one);
    assertSame(it.next(), three);
    assertFalse(it.hasNext());
}

64. ArrayBlockingQueueTest#testIterator()

Project: openjdk
Source File: ArrayBlockingQueueTest.java
View license
/**
     * iterator iterates through all elements
     */
public void testIterator() throws InterruptedException {
    ArrayBlockingQueue q = populatedQueue(SIZE);
    Iterator it = q.iterator();
    int i;
    for (i = 0; it.hasNext(); i++) assertTrue(q.contains(it.next()));
    assertEquals(i, SIZE);
    assertIteratorExhausted(it);
    it = q.iterator();
    for (i = 0; it.hasNext(); i++) assertEquals(it.next(), q.take());
    assertEquals(i, SIZE);
    assertIteratorExhausted(it);
}

65. SchemaWriter#dumpComplexTypeAttribute()

Project: openjdk
Source File: SchemaWriter.java
View license
private void dumpComplexTypeAttribute(XSComplexType type) {
    Iterator itr;
    itr = type.iterateAttGroups();
    while (itr.hasNext()) dumpRef((XSAttGroupDecl) itr.next());
    itr = type.iterateDeclaredAttributeUses();
    while (itr.hasNext()) attributeUse((XSAttributeUse) itr.next());
    XSWildcard awc = type.getAttributeWildcard();
    if (awc != null)
        wildcard("anyAttribute", awc, "");
}

66. SchemaWriter#attGroupDecl()

Project: openjdk
Source File: SchemaWriter.java
View license
public void attGroupDecl(XSAttGroupDecl decl) {
    Iterator itr;
    println(MessageFormat.format("<attGroup name=\"{0}\">", decl.getName()));
    indent++;
    // TODO: wildcard
    itr = decl.iterateAttGroups();
    while (itr.hasNext()) dumpRef((XSAttGroupDecl) itr.next());
    itr = decl.iterateDeclaredAttributeUses();
    while (itr.hasNext()) attributeUse((XSAttributeUse) itr.next());
    indent--;
    println("</attGroup>");
}

67. SchemaTreeTraverser#dumpComplexTypeAttribute()

Project: openjdk
Source File: SchemaTreeTraverser.java
View license
/**
     * Creates node for complex type.
     *
     * @param type Complex type.
     */
private void dumpComplexTypeAttribute(XSComplexType type) {
    Iterator itr;
    itr = type.iterateAttGroups();
    while (itr.hasNext()) {
        dumpRef((XSAttGroupDecl) itr.next());
    }
    itr = type.iterateDeclaredAttributeUses();
    while (itr.hasNext()) {
        attributeUse((XSAttributeUse) itr.next());
    }
}

68. SchemaTreeTraverser#attGroupDecl()

Project: openjdk
Source File: SchemaTreeTraverser.java
View license
/* (non-Javadoc)
     * @see com.sun.xml.internal.xsom.visitor.XSVisitor#attGroupDecl(com.sun.xml.internal.xsom.XSAttGroupDecl)
     */
public void attGroupDecl(XSAttGroupDecl decl) {
    SchemaTreeNode newNode = new SchemaTreeNode("Attribute group \"" + decl.getName() + "\"", decl.getLocator());
    this.currNode.add(newNode);
    this.currNode = newNode;
    Iterator itr;
    itr = decl.iterateAttGroups();
    while (itr.hasNext()) {
        dumpRef((XSAttGroupDecl) itr.next());
    }
    itr = decl.iterateDeclaredAttributeUses();
    while (itr.hasNext()) {
        attributeUse((XSAttributeUse) itr.next());
    }
    this.currNode = (SchemaTreeNode) this.currNode.getParent();
}

69. BindGreen#attContainer()

Project: openjdk
Source File: BindGreen.java
View license
public void attContainer(XSAttContainer cont) {
    // inline
    Iterator itr = cont.iterateDeclaredAttributeUses();
    while (itr.hasNext()) builder.ying((XSAttributeUse) itr.next(), cont);
    itr = cont.iterateAttGroups();
    while (itr.hasNext()) builder.ying((XSAttGroupDecl) itr.next(), cont);
    XSWildcard w = cont.getAttributeWildcard();
    if (w != null)
        builder.ying(w, cont);
}

70. FlowList#copyAndRedirect()

Project: openjdk
Source File: FlowList.java
View license
/**
     * Redirect the handles from oldList to newList. "This" flow list
     * is assumed to be relative to oldList.
     */
public FlowList copyAndRedirect(InstructionList oldList, InstructionList newList) {
    final FlowList result = new FlowList();
    if (_elements == null) {
        return result;
    }
    final int n = _elements.size();
    final Iterator oldIter = oldList.iterator();
    final Iterator newIter = newList.iterator();
    while (oldIter.hasNext()) {
        final InstructionHandle oldIh = (InstructionHandle) oldIter.next();
        final InstructionHandle newIh = (InstructionHandle) newIter.next();
        for (int i = 0; i < n; i++) {
            if (_elements.elementAt(i) == oldIh) {
                result.add(newIh);
            }
        }
    }
    return result;
}

71. TaggedProfileTemplateBase#getIOPComponents()

View license
public org.omg.IOP.TaggedComponent[] getIOPComponents(ORB orb, int id) {
    int count = 0;
    Iterator iter = iteratorById(id);
    while (iter.hasNext()) {
        iter.next();
        count++;
    }
    org.omg.IOP.TaggedComponent[] result = new org.omg.IOP.TaggedComponent[count];
    int index = 0;
    iter = iteratorById(id);
    while (iter.hasNext()) {
        TaggedComponent comp = (TaggedComponent) (iter.next());
        result[index++] = comp.getIOPComponent(orb);
    }
    return result;
}

72. ConcurrentLinkedQueueTest#testIteratorRemove()

View license
/**
     * iterator.remove removes current element
     */
public void testIteratorRemove() {
    final ConcurrentLinkedQueue q = new ConcurrentLinkedQueue();
    q.add(one);
    q.add(two);
    q.add(three);
    Iterator it = q.iterator();
    it.next();
    it.remove();
    it = q.iterator();
    assertSame(it.next(), two);
    assertSame(it.next(), three);
    assertFalse(it.hasNext());
}

73. ArrayBlockingQueueTest#testIteratorRemove()

Project: mapdb
Source File: ArrayBlockingQueueTest.java
View license
/**
     * iterator.remove removes current element
     */
public void testIteratorRemove() {
    final ArrayBlockingQueue q = new ArrayBlockingQueue(3);
    q.add(two);
    q.add(one);
    q.add(three);
    Iterator it = q.iterator();
    it.next();
    it.remove();
    it = q.iterator();
    assertSame(it.next(), one);
    assertSame(it.next(), three);
    assertFalse(it.hasNext());
}

74. ArrayBlockingQueueTest#testIterator()

Project: mapdb
Source File: ArrayBlockingQueueTest.java
View license
/**
     * iterator iterates through all elements
     */
public void testIterator() throws InterruptedException {
    ArrayBlockingQueue q = populatedQueue(SIZE);
    Iterator it = q.iterator();
    int i;
    for (i = 0; it.hasNext(); i++) assertTrue(q.contains(it.next()));
    assertEquals(i, SIZE);
    assertIteratorExhausted(it);
    it = q.iterator();
    for (i = 0; it.hasNext(); i++) assertEquals(it.next(), q.take());
    assertEquals(i, SIZE);
    assertIteratorExhausted(it);
}

75. Graphs#mdlToGraph()

Project: Mallet
Source File: Graphs.java
View license
/**
   * Converts a FactorGraph into a plain graph where each Variable is a vertex,
   * and two Variables are connected by an edge if they are arguments to the same factor. 
   *  (Essentially converts an fg into an MRF structure, minus the factors.)
   * @param fg
   * @return a Graph
   */
public static UndirectedGraph mdlToGraph(FactorGraph fg) {
    UndirectedGraph g = new SimpleGraph();
    for (Iterator it = fg.variablesIterator(); it.hasNext(); ) {
        Variable var = (Variable) it.next();
        g.addVertex(var);
    }
    for (Iterator it = fg.factorsIterator(); it.hasNext(); ) {
        Factor factor = (Factor) it.next();
        VarSet varSet = factor.varSet();
        int nv = varSet.size();
        for (int i = 0; i < nv; i++) {
            for (int j = i + 1; j < nv; j++) {
                g.addEdge(varSet.get(i), varSet.get(j));
            }
        }
    }
    return g;
}

76. TableFactor#multiplyAll()

Project: Mallet
Source File: TableFactor.java
View license
/**
   * Returns the product of a collection of multinomial potentials.
   */
/// xxx once there are other types of potentials, this will need to
/// be refactored into a Factors static-utilities class.
public static AbstractTableFactor multiplyAll(Collection phis) {
    if (phis.size() == 1) {
        Factor first = (Factor) phis.iterator().next();
        return (AbstractTableFactor) first.duplicate();
    }
    /* Get all the variables */
    VarSet vs = new HashVarSet();
    for (Iterator it = phis.iterator(); it.hasNext(); ) {
        Factor phi = (Factor) it.next();
        vs.addAll(phi.varSet());
    }
    /* define a new potential over the neighbors of NODE */
    TableFactor newCPF = new TableFactor(vs);
    for (Iterator it = phis.iterator(); it.hasNext(); ) {
        Factor phi = (Factor) it.next();
        newCPF.multiplyBy(phi);
    }
    return newCPF;
}

77. LogTableFactor#multiplyAll()

Project: Mallet
Source File: LogTableFactor.java
View license
public static LogTableFactor multiplyAll(Collection phis) {
    /* Get all the variables */
    VarSet vs = new HashVarSet();
    for (Iterator it = phis.iterator(); it.hasNext(); ) {
        Factor phi = (Factor) it.next();
        vs.addAll(phi.varSet());
    }
    /* define a new potential over the neighbors of NODE */
    LogTableFactor newCPF = new LogTableFactor(vs);
    for (Iterator it = phis.iterator(); it.hasNext(); ) {
        Factor phi = (Factor) it.next();
        newCPF.multiplyBy(phi);
    }
    return newCPF;
}

78. ResidualBP#propagate()

Project: Mallet
Source File: ResidualBP.java
View license
private void propagate(FactorGraph mdl) {
    // Send all messages in random order.
    ArrayList factors = new ArrayList(mdl.factors());
    Collections.shuffle(factors, rand);
    for (Iterator it = factors.iterator(); it.hasNext(); ) {
        Factor factor = (Factor) it.next();
        for (Iterator vit = factor.varSet().iterator(); vit.hasNext(); ) {
            Variable from = (Variable) vit.next();
            sendMessage(mdl, from, factor);
        }
    }
    for (Iterator it = factors.iterator(); it.hasNext(); ) {
        Factor factor = (Factor) it.next();
        for (Iterator vit = factor.varSet().iterator(); vit.hasNext(); ) {
            Variable to = (Variable) vit.next();
            sendMessage(mdl, factor, to);
        }
    }
}

79. LoopyBP#propagate()

Project: Mallet
Source File: LoopyBP.java
View license
private void propagate(FactorGraph mdl) {
    // Send all messages in random order.
    ArrayList factors = new ArrayList(mdl.factors());
    Collections.shuffle(factors, rand);
    for (Iterator it = factors.iterator(); it.hasNext(); ) {
        Factor factor = (Factor) it.next();
        for (Iterator vit = factor.varSet().iterator(); vit.hasNext(); ) {
            Variable from = (Variable) vit.next();
            sendMessage(mdl, from, factor);
        }
    }
    for (Iterator it = factors.iterator(); it.hasNext(); ) {
        Factor factor = (Factor) it.next();
        for (Iterator vit = factor.varSet().iterator(); vit.hasNext(); ) {
            Variable to = (Variable) vit.next();
            sendMessage(mdl, factor, to);
        }
    }
}

80. JunctionTree#entropy()

Project: Mallet
Source File: JunctionTree.java
View license
public double entropy() {
    double entropy = 0;
    for (Iterator it = clusterPotentials().iterator(); it.hasNext(); ) {
        Factor ptl = (Factor) it.next();
        entropy += ptl.entropy();
    }
    for (Iterator it = sepsetPotentials().iterator(); it.hasNext(); ) {
        Factor ptl = (Factor) it.next();
        entropy -= ptl.entropy();
    }
    return entropy;
}

81. AbstractMessageStrategy#msgProduct()

Project: Mallet
Source File: AbstractMessageStrategy.java
View license
Factor msgProduct(RegionEdge edge) {
    Factor product = new LogTableFactor(edge.from.vars);
    for (Iterator it = edge.neighboringParents.iterator(); it.hasNext(); ) {
        RegionEdge otherEdge = (RegionEdge) it.next();
        Factor otherMsg = oldMessages.getMessage(otherEdge.from, otherEdge.to);
        product.multiplyBy(otherMsg);
    }
    for (Iterator it = edge.loopingMessages.iterator(); it.hasNext(); ) {
        RegionEdge otherEdge = (RegionEdge) it.next();
        Factor otherMsg = newMessages.getMessage(otherEdge.from, otherEdge.to);
        product.divideBy(otherMsg);
    }
    return product;
}

82. Extraction#cleanFields()

Project: Mallet
Source File: Extraction.java
View license
public void cleanFields(FieldCleaner cleaner) {
    Iterator it = records.iterator();
    while (it.hasNext()) {
        cleanRecord((Record) it.next(), cleaner);
    }
    it = trueRecords.iterator();
    while (it.hasNext()) {
        cleanRecord((Record) it.next(), cleaner);
    }
}

83. PatternParserTest#convert()

Project: log4j-extras
Source File: PatternParserTest.java
View license
private static String convert(String pattern, Map registry, LoggingEvent event) {
    List converters = new ArrayList();
    List fields = new ArrayList();
    ExtrasPatternParser.parse(pattern, converters, fields, registry, ExtrasPatternParser.getPatternLayoutRules());
    assertEquals(converters.size(), fields.size());
    StringBuffer buf = new StringBuffer();
    Iterator converterIter = converters.iterator();
    Iterator fieldIter = fields.iterator();
    while (converterIter.hasNext()) {
        int fieldStart = buf.length();
        ((PatternConverter) converterIter.next()).format(event, buf);
        ((ExtrasFormattingInfo) fieldIter.next()).format(fieldStart, buf);
    }
    return buf.toString();
}

84. PatternParserTest#convert()

Project: log4j
Source File: PatternParserTest.java
View license
private static String convert(String pattern, Map registry, LoggingEvent event) {
    List converters = new ArrayList();
    List fields = new ArrayList();
    PatternParser.parse(pattern, converters, fields, registry, PatternParser.getPatternLayoutRules(), null);
    assertEquals(converters.size(), fields.size());
    StringBuffer buf = new StringBuffer();
    Iterator converterIter = converters.iterator();
    Iterator fieldIter = fields.iterator();
    while (converterIter.hasNext()) {
        int fieldStart = buf.length();
        ((PatternConverter) converterIter.next()).format(event, buf);
        ((FormattingInfo) fieldIter.next()).format(fieldStart, buf);
    }
    return buf.toString();
}

85. PNGImageWriter#write_tEXt()

Project: jdk7u-jdk
Source File: PNGImageWriter.java
View license
private void write_tEXt() throws IOException {
    Iterator keywordIter = metadata.tEXt_keyword.iterator();
    Iterator textIter = metadata.tEXt_text.iterator();
    while (keywordIter.hasNext()) {
        ChunkStream cs = new ChunkStream(PNGImageReader.tEXt_TYPE, stream);
        String keyword = (String) keywordIter.next();
        cs.writeBytes(keyword);
        cs.writeByte(0);
        String text = (String) textIter.next();
        cs.writeBytes(text);
        cs.finish();
    }
}

86. CharacterChange#checkForCharacterChange()

Project: JAdventure
Source File: CharacterChange.java
View license
public void checkForCharacterChange(Player player) {
    HashMap<String, Integer> characterLevels = player.getCharacterLevels();
    String currentCharacter = player.getCurrentCharacterType();
    int highestCharacterLevel = player.getCharacterLevel(currentCharacter);
    String highestCharacter = currentCharacter;
    Iterator it = characterLevels.entrySet().iterator();
    while (it.hasNext()) {
        Map.Entry pairs = (Map.Entry) it.next();
        int value = (int) pairs.getValue();
        if (value > highestCharacterLevel) {
            highestCharacterLevel = value;
            highestCharacter = (String) pairs.getKey();
        }
    }
    if (!highestCharacter.equals(currentCharacter)) {
        player.setCurrentCharacterType(highestCharacter);
        QueueProvider.offer("You're character type is now changed! You are now a " + highestCharacter + "!");
    }
    it = characterLevels.entrySet().iterator();
    while (it.hasNext()) {
        Map.Entry pairs = (Map.Entry) it.next();
        player.setCharacterLevel((String) pairs.getKey(), (int) pairs.getValue());
    }
}

87. SimpleEventListener#equals()

Project: jackrabbit
Source File: SimpleEventListener.java
View license
/**
     * Check whether two collections contain the same elements. Made necessary
     * because the <code>Collections.unmodifiableXXX</code> methods do not
     * return objects that override <code>equals</code> and <code>hashCode</code>.
     *
     * @param c1 collection 1
     * @param c2 collection 2
     * @return <code>true</code> if they are equal; <code>false</code> otherwise
     */
private static boolean equals(Collection c1, Collection c2) {
    if (c1.size() != c2.size()) {
        return false;
    }
    Iterator iter1 = c1.iterator();
    Iterator iter2 = c2.iterator();
    while (iter1.hasNext()) {
        Object o1 = iter1.next();
        Object o2 = iter2.next();
        if (!o1.equals(o2)) {
            return false;
        }
    }
    return true;
}

88. Collections10#doGet()

Project: JAADAS
Source File: Collections10.java
View license
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
    String s1 = req.getParameter(FIELD_NAME);
    LinkedList c1 = new LinkedList();
    c1.addLast(s1);
    ArrayList c2 = new ArrayList();
    c2.add("abc");
    Iterator iter = c1.iterator();
    PrintWriter writer = resp.getWriter();
    while (iter.hasNext()) {
        String str = (String) iter.next();
        writer.println(str);
    /* BAD */
    }
    iter = c2.iterator();
    while (iter.hasNext()) {
        String str = (String) iter.next();
        writer.println(str);
    /* OK */
    }
}

89. EqCollectionMatcher#matches()

Project: nifty-gui
Source File: EqCollectionMatcher.java
View license
@Override
public boolean matches(final Object actual) {
    if (!(actual instanceof Collection)) {
        errorText = "[not an Collection instance";
        return false;
    }
    Collection actualCollection = ((Collection) actual);
    if (expectedCollection.isEmpty()) {
        errorText = "[expected collection is empty, actual is not]";
        return actualCollection.isEmpty();
    }
    Iterator expectedIt = expectedCollection.iterator();
    Iterator actualIt = actualCollection.iterator();
    while (expectedIt.hasNext()) {
        Object expectedO = expectedIt.next();
        Object actualO = actualIt.next();
        if (expectedO != actualO) {
            errorText = "[expectedO : [" + expectedO + "] != actualO : [" + actualO + "]";
            return false;
        }
    }
    return true;
}

90. TreeSubSetTest#testDescendingIteratorRemove()

Project: mapdb
Source File: TreeSubSetTest.java
View license
/**
     * iterator.remove removes current element
     */
public void testDescendingIteratorRemove() {
    final NavigableSet q = dset0();
    q.add(new Integer(2));
    q.add(new Integer(1));
    q.add(new Integer(3));
    Iterator it = q.iterator();
    it.next();
    it.remove();
    it = q.iterator();
    assertEquals(2, it.next());
    assertEquals(3, it.next());
    assertFalse(it.hasNext());
}

91. TreeSubSetTest#testIteratorRemove()

Project: mapdb
Source File: TreeSubSetTest.java
View license
/**
     * iterator.remove removes current element
     */
public void testIteratorRemove() {
    final NavigableSet q = set0();
    q.add(new Integer(2));
    q.add(new Integer(1));
    q.add(new Integer(3));
    Iterator it = q.iterator();
    it.next();
    it.remove();
    it = q.iterator();
    assertEquals(2, it.next());
    assertEquals(3, it.next());
    assertFalse(it.hasNext());
}

92. TreeSetTest#testIteratorRemove()

Project: mapdb
Source File: TreeSetTest.java
View license
/**
     * iterator.remove removes current element
     */
public void testIteratorRemove() {
    final TreeSet q = new TreeSet();
    q.add(new Integer(2));
    q.add(new Integer(1));
    q.add(new Integer(3));
    Iterator it = q.iterator();
    it.next();
    it.remove();
    it = q.iterator();
    assertEquals(it.next(), new Integer(2));
    assertEquals(it.next(), new Integer(3));
    assertFalse(it.hasNext());
}

93. LinkedTransferQueueTest#testIteratorRemove()

Project: mapdb
Source File: LinkedTransferQueueTest.java
View license
/**
     * iterator.remove() removes current element
     */
public void testIteratorRemove() {
    final LinkedTransferQueue q = new LinkedTransferQueue();
    q.add(two);
    q.add(one);
    q.add(three);
    Iterator it = q.iterator();
    it.next();
    it.remove();
    it = q.iterator();
    assertSame(it.next(), one);
    assertSame(it.next(), three);
    assertFalse(it.hasNext());
}

94. LinkedTransferQueueTest#testIterator()

Project: mapdb
Source File: LinkedTransferQueueTest.java
View license
/**
     * iterator iterates through all elements
     */
public void testIterator() throws InterruptedException {
    LinkedTransferQueue q = populatedQueue(SIZE);
    Iterator it = q.iterator();
    int i;
    for (i = 0; it.hasNext(); i++) assertTrue(q.contains(it.next()));
    assertEquals(i, SIZE);
    assertIteratorExhausted(it);
    it = q.iterator();
    for (i = 0; it.hasNext(); i++) assertEquals(it.next(), q.take());
    assertEquals(i, SIZE);
    assertIteratorExhausted(it);
}

95. LinkedListTest#testDescendingIteratorRemove()

Project: mapdb
Source File: LinkedListTest.java
View license
/**
     * descendingIterator.remove removes current element
     */
public void testDescendingIteratorRemove() {
    final LinkedList q = new LinkedList();
    q.add(three);
    q.add(two);
    q.add(one);
    Iterator it = q.descendingIterator();
    it.next();
    it.remove();
    it = q.descendingIterator();
    assertSame(it.next(), two);
    assertSame(it.next(), three);
    assertFalse(it.hasNext());
}

96. LinkedBlockingQueueTest#testIteratorRemove()

Project: mapdb
Source File: LinkedBlockingQueueTest.java
View license
/**
     * iterator.remove removes current element
     */
public void testIteratorRemove() {
    final LinkedBlockingQueue q = new LinkedBlockingQueue(3);
    q.add(two);
    q.add(one);
    q.add(three);
    Iterator it = q.iterator();
    it.next();
    it.remove();
    it = q.iterator();
    assertSame(it.next(), one);
    assertSame(it.next(), three);
    assertFalse(it.hasNext());
}

97. DeepEquals#compareOrderedCollection()

Project: hudson-2.x
Source File: DeepEquals.java
View license
/**
     * Deeply compare two Collections that must be same length and in same order.
     * @param col1 First collection of items to compare
     * @param col2 Second collection of items to compare
     * @param stack add items to compare to the Stack (Stack versus recursion)
     * @param visited Set of objects already compared (prevents cycles)
     * value of 'true' indicates that the Collections may be equal, and the sets
     * items will be added to the Stack for further comparison.
     */
private static boolean compareOrderedCollection(Collection col1, Collection col2, LinkedList stack, Set visited) {
    if (col1.size() != col2.size()) {
        return false;
    }
    Iterator i1 = col1.iterator();
    Iterator i2 = col2.iterator();
    while (i1.hasNext()) {
        DualKey dk = new DualKey(i1.next(), i2.next());
        if (!visited.contains(dk)) {
            // push contents for further comparison
            stack.addFirst(dk);
        }
    }
    return true;
}

98. JobBase#getReport()

Project: hadoop-mapreduce
Source File: JobBase.java
View license
/**
   * log the counters
   * 
   */
protected String getReport() {
    StringBuffer sb = new StringBuffer();
    Iterator iter = this.longCounters.entrySet().iterator();
    while (iter.hasNext()) {
        Entry e = (Entry) iter.next();
        sb.append(e.getKey().toString()).append("\t").append(e.getValue()).append("\n");
    }
    iter = this.doubleCounters.entrySet().iterator();
    while (iter.hasNext()) {
        Entry e = (Entry) iter.next();
        sb.append(e.getKey().toString()).append("\t").append(e.getValue()).append("\n");
    }
    return sb.toString();
}

99. StreamJob#listJobConfProperties()

Project: hadoop-mapreduce
Source File: StreamJob.java
View license
/**
   * Prints out the jobconf properties on stdout
   * when verbose is specified.
   */
protected void listJobConfProperties() {
    msg("==== JobConf properties:");
    Iterator it = jobConf_.iterator();
    TreeMap sorted = new TreeMap();
    while (it.hasNext()) {
        Map.Entry en = (Map.Entry) it.next();
        sorted.put(en.getKey(), en.getValue());
    }
    it = sorted.entrySet().iterator();
    while (it.hasNext()) {
        Map.Entry en = (Map.Entry) it.next();
        msg(en.getKey() + "=" + en.getValue());
    }
    msg("====");
}

100. StreamJob#listJobConfProperties()

Project: hadoop-common
Source File: StreamJob.java
View license
/**
   * Prints out the jobconf properties on stdout
   * when verbose is specified.
   */
protected void listJobConfProperties() {
    msg("==== JobConf properties:");
    Iterator it = jobConf_.iterator();
    TreeMap sorted = new TreeMap();
    while (it.hasNext()) {
        Map.Entry en = (Map.Entry) it.next();
        sorted.put(en.getKey(), en.getValue());
    }
    it = sorted.entrySet().iterator();
    while (it.hasNext()) {
        Map.Entry en = (Map.Entry) it.next();
        msg(en.getKey() + "=" + en.getValue());
    }
    msg("====");
}