java.util.Iterator

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

1. 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);
        }
    }
}

2. 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();
}

3. 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;
}

4. 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());
    }
}

5. 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);
}

6. 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;
}

7. 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()]);
}

8. 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);
}

9. 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();
    }
}

10. 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()));
    }
}

11. 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);
        }
    }
}

12. 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());
    }
}

13. 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;
}

14. 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) {
    }
}

15. 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();
    }
}

16. 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());
    }
}

17. 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());
        }
    }
}

18. 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;
}

19. 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;
}

20. 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;
}

21. 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;
}

22. 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;
}

23. 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);
}

24. 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());
}

25. 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;
}

26. 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;
}

27. 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);
}

28. 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());
}

29. 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();
}

30. 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;
}

31. 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;
}

32. 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();
    }
}

33. 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;
}

34. 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;
}

35. 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);
    }
}

36. 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();
}

37. 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);
        }
    }
}

38. 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);
    }
}

39. 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;
}

40. 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);
}

41. ChainResolver#download()

Project: ant-ivy
Source File: ChainResolver.java
View license
public DownloadReport download(Artifact[] artifacts, Ivy ivy, File cache, boolean useOrigin) {
    List artifactsToDownload = new ArrayList(Arrays.asList(artifacts));
    DownloadReport report = new DownloadReport();
    for (Iterator iter = _chain.iterator(); iter.hasNext() && !artifactsToDownload.isEmpty(); ) {
        DependencyResolver resolver = (DependencyResolver) iter.next();
        DownloadReport r = resolver.download((Artifact[]) artifactsToDownload.toArray(new Artifact[artifactsToDownload.size()]), ivy, cache, useOrigin);
        ArtifactDownloadReport[] adr = r.getArtifactsReports();
        for (int i = 0; i < adr.length; i++) {
            if (adr[i].getDownloadStatus() != DownloadStatus.FAILED) {
                artifactsToDownload.remove(adr[i].getArtifact());
                report.addArtifactReport(adr[i]);
            }
        }
    }
    for (Iterator iter = artifactsToDownload.iterator(); iter.hasNext(); ) {
        Artifact art = (Artifact) iter.next();
        ArtifactDownloadReport adr = new ArtifactDownloadReport(art);
        adr.setDownloadStatus(DownloadStatus.FAILED);
        report.addArtifactReport(adr);
    }
    return report;
}

42. HTMLMetaTags#toString()

Project: anthelion
Source File: HTMLMetaTags.java
View license
public String toString() {
    StringBuffer sb = new StringBuffer();
    sb.append("base=" + baseHref + ", noCache=" + noCache + ", noFollow=" + noFollow + ", noIndex=" + noIndex + ", refresh=" + refresh + ", refreshHref=" + refreshHref + "\n");
    sb.append(" * general tags:\n");
    Iterator it = generalTags.keySet().iterator();
    while (it.hasNext()) {
        String key = (String) it.next();
        sb.append("   - " + key + "\t=\t" + generalTags.get(key) + "\n");
    }
    sb.append(" * http-equiv tags:\n");
    it = httpEquivTags.keySet().iterator();
    while (it.hasNext()) {
        String key = (String) it.next();
        sb.append("   - " + key + "\t=\t" + httpEquivTags.get(key) + "\n");
    }
    return sb.toString();
}

43. Subcollection#filter()

Project: anthelion
Source File: Subcollection.java
View license
/**
   * Simple "indexOf" currentFilter for matching patterns.
   * 
   * <pre>
   *  rules for evaluation are as follows:
   *  1. if pattern matches in blacklist then url is rejected
   *  2. if pattern matches in whitelist then url is allowed
   *  3. url is rejected
   * </pre>
   * 
   * @see org.apache.nutch.net.URLFilter#filter(java.lang.String)
   */
public String filter(String urlString) {
    // first the blacklist
    Iterator i = blackList.iterator();
    while (i.hasNext()) {
        String row = (String) i.next();
        if (urlString.indexOf(row) != -1)
            return null;
    }
    // then whitelist
    i = whiteList.iterator();
    while (i.hasNext()) {
        String row = (String) i.next();
        if (urlString.indexOf(row) != -1)
            return urlString;
    }
    return null;
}

44. MarketSummaryDataBean#toHTML()

View license
public String toHTML() {
    String ret = "<BR>Market Summary at: " + getSummaryDate() + "<LI>        TSIA:" + getTSIA() + "</LI>" + "<LI>    openTSIA:" + getOpenTSIA() + "</LI>" + "<LI>      volume:" + getVolume() + "</LI>";
    if ((getTopGainers() == null) || (getTopLosers() == null))
        return ret;
    ret += "<BR> Current Top Gainers:";
    Iterator it = getTopGainers().iterator();
    while (it.hasNext()) {
        QuoteDataBean quoteData = (QuoteDataBean) it.next();
        ret += ("<LI>" + quoteData.toString() + "</LI>");
    }
    ret += "<BR>   Current Top Losers:";
    it = getTopLosers().iterator();
    while (it.hasNext()) {
        QuoteDataBean quoteData = (QuoteDataBean) it.next();
        ret += ("<LI>" + quoteData.toString() + "</LI>");
    }
    return ret;
}

45. MarketSummaryDataBean#toHTML()

Project: aries
Source File: MarketSummaryDataBean.java
View license
public String toHTML() {
    String ret = "<BR>Market Summary at: " + getSummaryDate() + "<LI>        TSIA:" + getTSIA() + "</LI>" + "<LI>    openTSIA:" + getOpenTSIA() + "</LI>" + "<LI>      volume:" + getVolume() + "</LI>";
    if ((getTopGainers() == null) || (getTopLosers() == null))
        return ret;
    ret += "<BR> Current Top Gainers:";
    Iterator it = getTopGainers().iterator();
    while (it.hasNext()) {
        QuoteDataBean quoteData = (QuoteDataBean) it.next();
        ret += ("<LI>" + quoteData.toString() + "</LI>");
    }
    ret += "<BR>   Current Top Losers:";
    it = getTopLosers().iterator();
    while (it.hasNext()) {
        QuoteDataBean quoteData = (QuoteDataBean) it.next();
        ret += ("<LI>" + quoteData.toString() + "</LI>");
    }
    return ret;
}

46. Stub#addHeader()

Project: axis2-java
Source File: Stub.java
View license
protected void addHeader(OMElement omElementToadd, SOAPEnvelope envelop, boolean mustUnderstand) {
    SOAPHeaderBlock soapHeaderBlock = envelop.getHeader().addHeaderBlock(omElementToadd.getLocalName(), omElementToadd.getNamespace());
    soapHeaderBlock.setMustUnderstand(mustUnderstand);
    OMNode omNode = null;
    // add child elements
    for (Iterator iter = omElementToadd.getChildren(); iter.hasNext(); ) {
        omNode = (OMNode) iter.next();
        iter.remove();
        soapHeaderBlock.addChild(omNode);
    }
    OMAttribute omatribute = null;
    // add attributes
    for (Iterator iter = omElementToadd.getAllAttributes(); iter.hasNext(); ) {
        omatribute = (OMAttribute) iter.next();
        soapHeaderBlock.addAttribute(omatribute);
    }
}

47. JSONSearchModel#generateSnippet()

Project: axis2-java
Source File: JSONSearchModel.java
View license
private void generateSnippet(OMElement response) {
    String title = null;
    String summary = null;
    String clickUrl = null;
    String url = null;
    OMElement result = null;
    //get an iterator for Result elements
    Iterator itr = response.getChildElements();
    Iterator innerItr;
    while (itr.hasNext()) {
        result = (OMElement) itr.next();
        innerItr = result.getChildElements();
        if (innerItr.hasNext()) {
            title = ((OMElement) innerItr.next()).getText();
            summary = ((OMElement) innerItr.next()).getText();
            url = ((OMElement) innerItr.next()).getText();
            clickUrl = ((OMElement) innerItr.next()).getText();
            if (title != null) {
                snippet += "<a href=" + clickUrl + ">" + title + "</a>" + "<br>" + summary + "<br>" + url + "<br>" + "<br>";
            }
        }
    }
    snippet += endHTML;
}

48. RESTSearchModel#generateSnippet()

Project: axis2-java
Source File: RESTSearchModel.java
View license
private void generateSnippet(OMElement response) {
    String title = null;
    String summary = null;
    String clickUrl = null;
    String url = null;
    OMElement result = null;
    //get an iterator for Result elements
    Iterator itr = response.getChildElements();
    Iterator innerItr;
    while (itr.hasNext()) {
        result = (OMElement) itr.next();
        innerItr = result.getChildElements();
        title = ((OMElement) innerItr.next()).getText();
        summary = ((OMElement) innerItr.next()).getText();
        url = ((OMElement) innerItr.next()).getText();
        clickUrl = ((OMElement) innerItr.next()).getText();
        snippet += "<a href=" + clickUrl + ">" + title + "</a>" + "<br>" + summary + "<br>" + url + "<br>" + "<br>";
    }
    snippet += endHTML;
}

49. CharacterChange#checkForCharacterChange()

Project: Bailu
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());
    }
}

50. AbstractRable#getPropertyNames()

Project: batik
Source File: AbstractRable.java
View license
public String[] getPropertyNames() {
    Set keys = props.keySet();
    Iterator iter = keys.iterator();
    String[] ret = new String[keys.size()];
    int i = 0;
    while (iter.hasNext()) {
        ret[i++] = (String) iter.next();
    }
    iter = srcs.iterator();
    while (iter.hasNext()) {
        RenderableImage ri = (RenderableImage) iter.next();
        String[] srcProps = ri.getPropertyNames();
        if (srcProps.length != 0) {
            String[] tmp = new String[ret.length + srcProps.length];
            System.arraycopy(ret, 0, tmp, 0, ret.length);
            System.arraycopy(tmp, ret.length, srcProps, 0, srcProps.length);
            ret = tmp;
        }
    }
    return ret;
}

51. DefaultXBLManager#shadowTreeSelectedContentChanged()

Project: batik
Source File: DefaultXBLManager.java
View license
/**
     * Called by the ContentManager of a shadow tree to indicate some
     * selected nodes have changed.
     */
void shadowTreeSelectedContentChanged(Set deselected, Set selected) {
    Iterator i = deselected.iterator();
    while (i.hasNext()) {
        Node n = (Node) i.next();
        if (n.getNodeType() == Node.ELEMENT_NODE) {
            unbind((Element) n);
        }
    }
    i = selected.iterator();
    while (i.hasNext()) {
        Node n = (Node) i.next();
        if (n.getNodeType() == Node.ELEMENT_NODE) {
            bind((Element) n);
        }
    }
}

52. LengthArrayProducer#endLengthList()

Project: batik
Source File: LengthArrayProducer.java
View license
/**
     * Invoked when the length list attribute ends.
     * @exception ParseException if an error occures while processing the
     *                           number list.
     */
public void endLengthList() throws ParseException {
    float[] allValues = new float[count];
    int pos = 0;
    Iterator it = vs.iterator();
    while (it.hasNext()) {
        float[] a = (float[]) it.next();
        System.arraycopy(a, 0, allValues, pos, a.length);
        pos += a.length;
    }
    System.arraycopy(v, 0, allValues, pos, index);
    vs.clear();
    v = allValues;
    short[] allUnits = new short[count];
    pos = 0;
    it = us.iterator();
    while (it.hasNext()) {
        short[] a = (short[]) it.next();
        System.arraycopy(a, 0, allUnits, pos, a.length);
        pos += a.length;
    }
    System.arraycopy(u, 0, allUnits, pos, index);
    us.clear();
    u = allUnits;
}

53. PathArrayProducer#endPath()

Project: batik
Source File: PathArrayProducer.java
View license
/**
     * Implements [email protected] PathHandler#endPath()}.
     */
public void endPath() throws ParseException {
    short[] allCommands = new short[ccount];
    int pos = 0;
    Iterator it = cs.iterator();
    while (it.hasNext()) {
        short[] a = (short[]) it.next();
        System.arraycopy(a, 0, allCommands, pos, a.length);
        pos += a.length;
    }
    System.arraycopy(c, 0, allCommands, pos, cindex);
    cs.clear();
    c = allCommands;
    float[] allParams = new float[pcount];
    pos = 0;
    it = ps.iterator();
    while (it.hasNext()) {
        float[] a = (float[]) it.next();
        System.arraycopy(a, 0, allParams, pos, a.length);
        pos += a.length;
    }
    System.arraycopy(p, 0, allParams, pos, pindex);
    ps.clear();
    p = allParams;
}

54. DefaultMessageCodesResolver#resolveMessageCodes()

View license
/**
	 * Build the code list for the given code and field: an
	 * object/field-specific code, a field-specific code, a plain error code.
	 * <p>Arrays, Lists and Maps are resolved both for specific elements and
	 * the whole collection.
	 * <p>See the [email protected] DefaultMessageCodesResolver class level Javadoc} for
	 * details on the generated codes.
	 * @return the list of codes
	 */
public String[] resolveMessageCodes(String errorCode, String objectName, String field, Class fieldType) {
    List codeList = new ArrayList();
    List fieldList = new ArrayList();
    buildFieldList(field, fieldList);
    for (Iterator it = fieldList.iterator(); it.hasNext(); ) {
        String fieldInList = (String) it.next();
        codeList.add(postProcessMessageCode(errorCode + CODE_SEPARATOR + objectName + CODE_SEPARATOR + fieldInList));
    }
    int dotIndex = field.lastIndexOf('.');
    if (dotIndex != -1) {
        buildFieldList(field.substring(dotIndex + 1), fieldList);
    }
    for (Iterator it = fieldList.iterator(); it.hasNext(); ) {
        String fieldInList = (String) it.next();
        codeList.add(postProcessMessageCode(errorCode + CODE_SEPARATOR + fieldInList));
    }
    if (fieldType != null) {
        codeList.add(postProcessMessageCode(errorCode + CODE_SEPARATOR + fieldType.getName()));
    }
    codeList.add(postProcessMessageCode(errorCode));
    return SimpleStringUtil.toStringArray(codeList);
}

55. TabServletContextListener#contextInitialized()

View license
/**
	 *	Handles finding all CSS, JavaScript, and image resources from this
	 *	taglib's JAR file and copies them to a directory in the web app's
	 *	root directory where the tab components can link to them.
	 */
public void contextInitialized(final ServletContextEvent evt) {
    ServletContext servletContext = evt.getServletContext();
    createDitchnetDir(servletContext);
    String sourcePath, destPath, fileName;
    URL sourceURL;
    int i = 0;
    for (Iterator iter = RESOURCE_PATHS.iterator(); iter.hasNext(); ) {
        sourcePath = (String) iter.next();
        sourceURL = getClass().getResource(sourcePath);
        destPath = (String) DEST_PATHS.get(i);
        destPath = servletContext.getRealPath(destPath);
        writeFile(sourceURL, destPath, servletContext);
        i++;
    }
    for (Iterator iter = IMAGE_RESOURCE_NAMES.iterator(); iter.hasNext(); ) {
        fileName = (String) iter.next();
        sourcePath = IMAGE_RESOURCE_FOLDER + fileName;
        sourceURL = getClass().getResource(sourcePath);
        destPath = DEST_FOLDER_NAME + fileName;
        destPath = servletContext.getRealPath(destPath);
        writeFile(sourceURL, destPath, servletContext);
    }
}

56. JcaCertStoreBuilder#convertHolders()

Project: bc-java
Source File: JcaCertStoreBuilder.java
View license
private CollectionCertStoreParameters convertHolders(JcaX509CertificateConverter certificateConverter, JcaX509CRLConverter crlConverter) throws CertificateException, CRLException {
    List jcaObjs = new ArrayList(certs.size() + crls.size());
    for (Iterator it = certs.iterator(); it.hasNext(); ) {
        jcaObjs.add(certificateConverter.getCertificate((X509CertificateHolder) it.next()));
    }
    for (Iterator it = crls.iterator(); it.hasNext(); ) {
        jcaObjs.add(crlConverter.getCRL((X509CRLHolder) it.next()));
    }
    return new CollectionCertStoreParameters(jcaObjs);
}

57. CMSSignedDataStreamGenerator#checkForVersion3()

View license
private boolean checkForVersion3(List signerInfos, List signerInfoGens) {
    for (Iterator it = signerInfos.iterator(); it.hasNext(); ) {
        SignerInfo s = SignerInfo.getInstance(((SignerInformation) it.next()).toASN1Structure());
        if (s.getVersion().getValue().intValue() == 3) {
            return true;
        }
    }
    for (Iterator it = signerInfoGens.iterator(); it.hasNext(); ) {
        SignerInfoGenerator s = (SignerInfoGenerator) it.next();
        if (s.getGeneratedVersion() == 3) {
            return true;
        }
    }
    return false;
}

58. JcaCertStoreBuilder#convertHolders()

Project: bc-java
Source File: JcaCertStoreBuilder.java
View license
private CollectionCertStoreParameters convertHolders(JcaX509CertificateConverter certificateConverter, JcaX509CRLConverter crlConverter) throws CertificateException, CRLException {
    List jcaObjs = new ArrayList(certs.size() + crls.size());
    for (Iterator it = certs.iterator(); it.hasNext(); ) {
        jcaObjs.add(certificateConverter.getCertificate((X509CertificateHolder) it.next()));
    }
    for (Iterator it = crls.iterator(); it.hasNext(); ) {
        jcaObjs.add(crlConverter.getCRL((X509CRLHolder) it.next()));
    }
    return new CollectionCertStoreParameters(jcaObjs);
}

59. JcaCertStoreBuilder#convertHolders()

Project: bc-java
Source File: JcaCertStoreBuilder.java
View license
private CollectionCertStoreParameters convertHolders(JcaX509CertificateConverter certificateConverter, JcaX509CRLConverter crlConverter) throws CertificateException, CRLException {
    List jcaObjs = new ArrayList(certs.size() + crls.size());
    for (Iterator it = certs.iterator(); it.hasNext(); ) {
        jcaObjs.add(certificateConverter.getCertificate((X509CertificateHolder) it.next()));
    }
    for (Iterator it = crls.iterator(); it.hasNext(); ) {
        jcaObjs.add(crlConverter.getCRL((X509CRLHolder) it.next()));
    }
    return new CollectionCertStoreParameters(jcaObjs);
}

60. EscherContainerRecord#serialize()

View license
public int serialize(int offset, byte[] data, EscherSerializationListener listener) {
    listener.beforeRecordSerialize(offset, getRecordId(), this);
    LittleEndian.putShort(data, offset, getOptions());
    LittleEndian.putShort(data, offset + 2, getRecordId());
    int remainingBytes = 0;
    for (Iterator iterator = getChildRecords().iterator(); iterator.hasNext(); ) {
        EscherRecord r = (EscherRecord) iterator.next();
        remainingBytes += r.getRecordSize();
    }
    LittleEndian.putInt(data, offset + 4, remainingBytes);
    int pos = offset + 8;
    for (Iterator iterator = getChildRecords().iterator(); iterator.hasNext(); ) {
        EscherRecord r = (EscherRecord) iterator.next();
        pos += r.serialize(pos, data, listener);
    }
    listener.afterRecordSerialize(pos, getRecordId(), pos - offset, this);
    return pos - offset;
}

61. UnknownEscherRecord#serialize()

Project: bioformats
Source File: UnknownEscherRecord.java
View license
/**
     * Writes this record and any contained records to the supplied byte
     * array.
     *
     * @return  the number of bytes written.
     */
public int serialize(int offset, byte[] data, EscherSerializationListener listener) {
    listener.beforeRecordSerialize(offset, getRecordId(), this);
    LittleEndian.putShort(data, offset, getOptions());
    LittleEndian.putShort(data, offset + 2, getRecordId());
    int remainingBytes = thedata.length;
    for (Iterator iterator = getChildRecords().iterator(); iterator.hasNext(); ) {
        EscherRecord r = (EscherRecord) iterator.next();
        remainingBytes += r.getRecordSize();
    }
    LittleEndian.putInt(data, offset + 4, remainingBytes);
    System.arraycopy(thedata, 0, data, offset + 8, thedata.length);
    int pos = offset + 8 + thedata.length;
    for (Iterator iterator = getChildRecords().iterator(); iterator.hasNext(); ) {
        EscherRecord r = (EscherRecord) iterator.next();
        pos += r.serialize(pos, data, listener);
    }
    listener.afterRecordSerialize(pos, getRecordId(), pos - offset, this);
    return pos - offset;
}

62. Sheet#shiftBreaks()

Project: bioformats
Source File: Sheet.java
View license
/**
     * Shifts all the page breaks in the range "count" number of rows/columns
     * @param breaks The page record to be shifted
     * @param start Starting "main" value to shift breaks
     * @param stop Ending "main" value to shift breaks
     * @param count number of units (rows/columns) to shift by 
     */
public void shiftBreaks(PageBreakRecord breaks, short start, short stop, int count) {
    if (rowBreaks == null)
        return;
    Iterator iterator = breaks.getBreaksIterator();
    List shiftedBreak = new ArrayList();
    while (iterator.hasNext()) {
        PageBreakRecord.Break breakItem = (PageBreakRecord.Break) iterator.next();
        short breakLocation = breakItem.main;
        boolean inStart = (breakLocation >= start);
        boolean inEnd = (breakLocation <= stop);
        if (inStart && inEnd)
            shiftedBreak.add(breakItem);
    }
    iterator = shiftedBreak.iterator();
    while (iterator.hasNext()) {
        PageBreakRecord.Break breakItem = (PageBreakRecord.Break) iterator.next();
        breaks.removeBreak(breakItem.main);
        breaks.addBreak((short) (breakItem.main + count), breakItem.subFrom, breakItem.subTo);
    }
}

63. Neo4jGraphSpecificTestSuite#testIndexParameters()

View license
public void testIndexParameters() throws Exception {
    Neo4jGraph graph = (Neo4jGraph) graphTest.generateGraph();
    Index<Vertex> index = graph.createIndex("luceneIdx", Vertex.class, new Parameter<String, String>("analyzer", LowerCaseKeywordAnalyzer.class.getName()));
    Vertex a = graph.addVertex(null);
    a.setProperty("name", "marko");
    index.put("name", "marko", a);
    Iterator itty = index.query("name", "*rko").iterator();
    int counter = 0;
    while (itty.hasNext()) {
        counter++;
        assertEquals(itty.next(), a);
    }
    assertEquals(counter, 1);
    itty = index.query("name", "MaRkO").iterator();
    counter = 0;
    while (itty.hasNext()) {
        counter++;
        assertEquals(itty.next(), a);
    }
    assertEquals(counter, 1);
    graph.shutdown();
}

64. DeltaProcessor#resetProjectCaches()

Project: che
Source File: DeltaProcessor.java
View license
/*
     * Traverse the set of projects which have changed namespace, and reset their
     * caches and their dependents
     */
public void resetProjectCaches() {
    if (this.projectCachesToReset.size() == 0)
        return;
    //		JavaModelManager.getJavaModelManager().resetJarTypeCache();
    Iterator iterator = this.projectCachesToReset.iterator();
    HashMap projectDepencies = this.state.projectDependencies;
    HashSet affectedDependents = new HashSet();
    while (iterator.hasNext()) {
        JavaProject project = (JavaProject) iterator.next();
        project.resetCaches();
        addDependentProjects(project, projectDepencies, affectedDependents);
    }
    // reset caches of dependent projects
    iterator = affectedDependents.iterator();
    while (iterator.hasNext()) {
        JavaProject project = (JavaProject) iterator.next();
        project.resetCaches();
    }
    this.projectCachesToReset.clear();
}

65. Bindings#put()

Project: chipKIT32-MAX
Source File: Bindings.java
View license
/**
	 * Copies data from the Java Bean to the UI components.
	 * Clears the _modified flag.
	 */
public void put(IValidatable bean) {
    for (Iterator iter = _optComponents.values().iterator(); iter.hasNext(); ) {
        ((Binding) iter.next()).put(bean);
    }
    for (Iterator iter = _bindings.values().iterator(); iter.hasNext(); ) {
        Binding b = (Binding) iter.next();
        if (isPropertyNull(bean, b)) {
            b.clear(null);
        } else {
            b.put(bean);
        }
    }
    _modified = false;
}

66. List#normalizeIndentation()

Project: clj-pdf
Source File: List.java
View license
// extra methods
/** Makes sure all the items in the list have the same indentation. */
public void normalizeIndentation() {
    float max = 0;
    Element o;
    for (Iterator i = list.iterator(); i.hasNext(); ) {
        o = (Element) i.next();
        if (o instanceof ListItem) {
            max = Math.max(max, ((ListItem) o).getIndentationLeft());
        }
    }
    for (Iterator i = list.iterator(); i.hasNext(); ) {
        o = (Element) i.next();
        if (o instanceof ListItem) {
            ((ListItem) o).setIndentationLeft(max);
        }
    }
}

67. PdfArray#toPdf()

Project: clj-pdf
Source File: PdfArray.java
View license
// METHODS OVERRIDING SOME PDFOBJECT METHODS
/**
     * Writes the PDF representation of this <CODE>PdfArray</CODE> as an array
     * of <CODE>byte</CODE> to the specified <CODE>OutputStream</CODE>.
     *
     * @param writer for backwards compatibility
     * @param os the <CODE>OutputStream</CODE> to write the bytes to.
     */
public void toPdf(PdfWriter writer, OutputStream os) throws IOException {
    os.write('[');
    Iterator i = arrayList.iterator();
    PdfObject object;
    int type = 0;
    if (i.hasNext()) {
        object = (PdfObject) i.next();
        if (object == null)
            object = PdfNull.PDFNULL;
        object.toPdf(writer, os);
    }
    while (i.hasNext()) {
        object = (PdfObject) i.next();
        if (object == null)
            object = PdfNull.PDFNULL;
        type = object.type();
        if (type != PdfObject.ARRAY && type != PdfObject.DICTIONARY && type != PdfObject.NAME && type != PdfObject.STRING)
            os.write(' ');
        object.toPdf(writer, os);
    }
    os.write(']');
}

68. LanguageImpl#toString()

Project: cocoon
Source File: LanguageImpl.java
View license
public String toString(final int indent) {
    StringBuffer buffer = new StringBuffer(50);
    StringUtils.newLine(buffer, indent);
    buffer.append(getClass().toString());
    buffer.append(":");
    StringUtils.newLine(buffer, indent);
    buffer.append("{");
    StringUtils.newLine(buffer, indent);
    buffer.append("locale='");
    buffer.append(locale);
    buffer.append("'");
    StringUtils.newLine(buffer, indent);
    buffer.append("title='");
    buffer.append(title);
    buffer.append("'");
    StringUtils.newLine(buffer, indent);
    buffer.append("shortTitle='");
    buffer.append(shortTitle);
    buffer.append("'");
    Iterator iterator = keywords.iterator();
    if (iterator.hasNext()) {
        StringUtils.newLine(buffer, indent);
        buffer.append("Keywords:");
    }
    while (iterator.hasNext()) {
        buffer.append(iterator.next());
        buffer.append(',');
    }
    StringUtils.newLine(buffer, indent);
    buffer.append("}");
    return buffer.toString();
}

69. PortletURLConverter#toString()

Project: cocoon
Source File: PortletURLConverter.java
View license
/**
     * Returns the marshalled URL.
     * @return A String containing the marshalled URL.
     */
public String toString() {
    StringBuffer buffer = new StringBuffer("");
    buffer.append(PORTLET_ID).append(PREFIX).append(portletId);
    Iterator iter = urlData.entrySet().iterator();
    while (iter.hasNext()) {
        buffer.append("/");
        Map.Entry entry = (Map.Entry) iter.next();
        buffer.append(entry.getKey()).append(PREFIX).append(entry.getValue());
    }
    iter = this.parameters.entrySet().iterator();
    while (iter.hasNext()) {
        buffer.append("/");
        Map.Entry entry = (Map.Entry) iter.next();
        buffer.append(entry.getKey()).append(PREFIX).append(entry.getValue());
    }
    return buffer.toString();
}

70. PropertySheetTableModel#setProperties()

View license
/* (non-Javadoc)
   * @see com.l2fprod.common.propertysheet.PropertySheet#setProperties(com.l2fprod.common.propertysheet.Property[])
   */
public void setProperties(Property[] newProperties) {
    // unregister the listeners from previous properties
    for (Iterator iter = properties.iterator(); iter.hasNext(); ) {
        Property prop = (Property) iter.next();
        prop.removePropertyChangeListener(this);
    }
    // replace the current properties
    properties.clear();
    properties.addAll(Arrays.asList(newProperties));
    // add listeners
    for (Iterator iter = properties.iterator(); iter.hasNext(); ) {
        Property prop = (Property) iter.next();
        prop.addPropertyChangeListener(this);
    }
    buildModel();
}

71. RuntimeAttributesTestCase#collectionsEquals()

View license
protected void collectionsEquals(Collection a, Collection b) {
    if (a.size() != b.size()) {
        fail("A=" + a + " B=" + b);
    }
    Iterator iter = a.iterator();
    while (iter.hasNext()) {
        Object o = iter.next();
        if (!b.contains(o)) {
            fail("B does not contain " + o);
        }
    }
    iter = b.iterator();
    while (iter.hasNext()) {
        Object o = iter.next();
        if (!a.contains(o)) {
            fail("A does not contain " + o);
        }
    }
}

72. BeanModelTestCase#testIterateAndSet()

View license
public void testIterateAndSet() {
    JXPathContext context = JXPathContext.newContext(createContextBean());
    Iterator it = context.iteratePointers("beans/int");
    int i = 5;
    while (it.hasNext()) {
        NodePointer pointer = (NodePointer) it.next();
        pointer.setValue(new Integer(i++));
    }
    it = context.iteratePointers("beans/int");
    List actual = new ArrayList();
    while (it.hasNext()) {
        actual.add(((Pointer) it.next()).getValue());
    }
    assertEquals("Iterating <" + "beans/int" + ">", list(new Integer(5), new Integer(6)), actual);
}

73. TorrentFilter#getTorrents()

View license
public List getTorrents(List torrentsToMatch, List args) {
    // first, try to match the whole list concatenated as a string
    StringBuffer allArgs = new StringBuffer();
    boolean first = true;
    for (Iterator iter = args.iterator(); iter.hasNext(); ) {
        if (!first)
            allArgs.append(",");
        else
            first = false;
        allArgs.append(iter.next());
    }
    List torrents;
    torrents = matchWildcard(torrentsToMatch, allArgs.toString());
    if (torrents.size() > 0)
        return torrents;
    torrents = matchRange(torrentsToMatch, allArgs.toString());
    if (torrents.size() > 0)
        return torrents;
    // if no torrents then handle each argument individually
    for (Iterator iter = args.iterator(); iter.hasNext(); ) {
        torrents.addAll(getTorrents(torrentsToMatch, (String) iter.next()));
    }
    return torrents;
}

74. XMLRenderer#transferForeignObjects()

Project: fop
Source File: XMLRenderer.java
View license
private void transferForeignObjects(AreaTreeObject ato) {
    Map prefixes = new java.util.HashMap();
    Iterator iter = ato.getForeignAttributes().entrySet().iterator();
    while (iter.hasNext()) {
        Map.Entry entry = (Map.Entry) iter.next();
        QName qname = (QName) entry.getKey();
        prefixes.put(qname.getPrefix(), qname.getNamespaceURI());
        addAttribute(qname, (String) entry.getValue());
    }
    //Namespace declarations
    iter = prefixes.entrySet().iterator();
    while (iter.hasNext()) {
        Map.Entry entry = (Map.Entry) iter.next();
        String qn = "xmlns:" + (String) entry.getKey();
        atts.addAttribute("", (String) entry.getKey(), qn, CDATA, (String) entry.getValue());
    }
}

75. SolrSearchGenerator#preparePost()

Project: forrest
Source File: SolrSearchGenerator.java
View license
private PostMethod preparePost() {
    PostMethod filePost = new PostMethod(destination);
    filePost.addRequestHeader("User-Agent", AGENT);
    Iterator keys = map.keySet().iterator();
    HashSet set = new HashSet();
    while (keys.hasNext()) {
        String element = (String) keys.next();
        if (!QUERY_PARAM.equals(element)) {
            String value = (String) map.get(element);
            set.add(new NameValuePair(element, value));
        }
    }
    //make sure we send the query (even if null) to get a response
    set.add(new NameValuePair(QUERY_PARAM, query));
    for (Iterator iter = set.iterator(); iter.hasNext(); ) {
        filePost.addParameter((NameValuePair) iter.next());
    }
    return filePost;
}

76. Graph#toString()

Project: freedomotic
Source File: Graph.java
View license
/**
     *
     * @return
     */
@Override
public String toString() {
    StringBuilder out = new StringBuilder();
    Object nodo;
    GraphEdge a;
    Iterator arcoI;
    Iterator nodoI = nodi.keySet().iterator();
    while (nodoI.hasNext()) {
        arcoI = ((Set) nodi.get(nodo = nodoI.next())).iterator();
        out.append("Nodo ").append(nodo.toString()).append(": ");
        while (arcoI.hasNext()) {
            a = (GraphEdge) arcoI.next();
            //out.append( ((a.x == nodo ) ? a.y.toString() : a.x.toString()) + "("+a.value.toString()+"), ");
            out.append(a.toString()).append(", ");
        }
        out.append("\n");
    }
    return out.toString();
}

77. TreeSetStringSerialiser#serialise()

Project: Gaffer
Source File: TreeSetStringSerialiser.java
View license
@Override
public byte[] serialise(final Object object) throws SerialisationException {
    final StringBuilder builder = new StringBuilder(OPEN);
    final Iterator values = ((TreeSet) object).iterator();
    if (values.hasNext()) {
        builder.append(values.next());
    }
    while (values.hasNext()) {
        builder.append(COMMA).append(values.next());
    }
    builder.append(CLOSE);
    try {
        return builder.toString().getBytes(CommonConstants.UTF_8);
    } catch (UnsupportedEncodingException e) {
        throw new SerialisationException(e.getMessage(), e);
    }
}

78. ParameterList#hasSameTypes()

Project: geronimo
Source File: ParameterList.java
View license
public boolean hasSameTypes(ParameterList that) {
    if (this.size() != that.size()) {
        return false;
    }
    Iterator i = this.iterator();
    Iterator j = that.iterator();
    for (; i.hasNext(); ) {
        MethodParameter mp1 = (MethodParameter) i.next();
        MethodParameter mp2 = (MethodParameter) j.next();
        if (!mp1.type.equals(mp2.type)) {
            return false;
        }
    }
    return true;
}

79. ApplicationPolicyConfigurationManager#doStop()

View license
public void doStop() throws Exception {
    for (Iterator iterator = roleDesignates.entrySet().iterator(); iterator.hasNext(); ) {
        Map.Entry entry = (Map.Entry) iterator.next();
        Subject roleDesignate = (Subject) entry.getValue();
        ContextManager.unregisterSubject(roleDesignate);
    }
    for (Iterator iterator = contextIdToPolicyConfigurationMap.values().iterator(); iterator.hasNext(); ) {
        PolicyConfiguration policyConfiguration = (PolicyConfiguration) iterator.next();
        policyConfiguration.delete();
    }
}

80. NonRestartableStopCondition#updateConditions()

View license
private void updateConditions() {
    if (isDestroyed())
        throw new IllegalStateException("destroyed");
    Set conditions = getConditions();
    // add the new conditions
    Set stopConditions = serviceFactory.getStopConditions();
    for (Iterator iterator = stopConditions.iterator(); iterator.hasNext(); ) {
        ServiceCondition condition = (ServiceCondition) iterator.next();
        if (!conditions.contains(condition)) {
            addCondition(condition);
        }
    }
    // remove the conditions that were dropped
    for (Iterator iterator = conditions.iterator(); iterator.hasNext(); ) {
        ServiceCondition serviceCondition = (ServiceCondition) iterator.next();
        if (!stopConditions.contains(serviceCondition)) {
            removeCondition(serviceCondition);
        }
    }
}

81. ServiceMonitorBroadcasterTest#initMonitors()

View license
private void initMonitors(int serviceId, Throwable throwable) {
    if (throwable != null) {
        kernelMonitor.init(expectedMonitors[serviceId], serviceEvent[serviceId], throwable, kernelThrowable);
    } else {
        kernelMonitor.init(Collections.EMPTY_SET, null, null, null);
    }
    for (Iterator iterator = expectedMonitors[serviceId].iterator(); iterator.hasNext(); ) {
        ((MockServiceMonitor) iterator.next()).init(serviceEvent[serviceId], throwable);
    }
    for (Iterator iterator = unexpectedMonitors[serviceId].iterator(); iterator.hasNext(); ) {
        ((MockServiceMonitor) iterator.next()).init(null, throwable);
    }
}

82. LoadAllMain#load()

Project: geronimo-xbean
Source File: LoadAllMain.java
View license
private void load(String location) {
    List loaders = kernel.getServices(Loader.class);
    for (Iterator iterator = loaders.iterator(); iterator.hasNext(); ) {
        Loader loader = (Loader) iterator.next();
        try {
            ServiceName configurationName = loader.load(location);
            if (configurationName != null) {
                kernel.startServiceRecursive(configurationName);
                return;
            }
        } catch (Exception e) {
            throw new FatalStartupError("Error loading '" + location + "' with " + loader, e);
        }
    }
    String message = "No loaders were able to load '" + location + "' : Available loaders ";
    for (Iterator iterator = loaders.iterator(); iterator.hasNext(); ) {
        message += iterator.next();
        if (iterator.hasNext()) {
            message += ", ";
        }
    }
    throw new FatalStartupError(message);
}

83. NamedConstructorArgs#selectConstructor()

View license
private ConstructionInfo selectConstructor(Class beanClass, MappingMetaData metadata, Set definedProperties) {
    // get the constructors sorted by longest arg length first
    List constructors = new ArrayList(Arrays.asList(beanClass.getConstructors()));
    Collections.sort(constructors, new ArgLengthComparator());
    // if a constructor has been annotated as the default constructor we always use that constructor
    for (Iterator iterator = constructors.iterator(); iterator.hasNext(); ) {
        Constructor constructor = (Constructor) iterator.next();
        if (metadata.isDefaultConstructor(constructor)) {
            return new ConstructionInfo(constructor, metadata);
        }
    }
    // try to find a constructor for which we have all of the properties defined
    for (Iterator iterator = constructors.iterator(); iterator.hasNext(); ) {
        Constructor constructor = (Constructor) iterator.next();
        ConstructionInfo constructionInfo = new ConstructionInfo(constructor, metadata);
        if (isUsableConstructor(constructionInfo, definedProperties)) {
            return constructionInfo;
        }
    }
    return null;
}

84. XmlMetadataGenerator#generatePropertiesFileConstructor()

View license
private void generatePropertiesFileConstructor(PrintWriter out, ElementMapping element, List args) {
    out.print(element.getClassName());
    if (element.getFactoryMethod() != null) {
        out.print("." + element.getFactoryMethod());
    }
    out.print("(");
    for (Iterator iterator = args.iterator(); iterator.hasNext(); ) {
        ParameterMapping parameterMapping = (ParameterMapping) iterator.next();
        out.print(parameterMapping.getType().getName());
        if (iterator.hasNext()) {
            out.print(",");
        }
    }
    out.print(").parameterNames =");
    for (Iterator iterator = args.iterator(); iterator.hasNext(); ) {
        ParameterMapping parameterMapping = (ParameterMapping) iterator.next();
        out.print(" ");
        out.print(parameterMapping.getName());
    }
    out.println();
}

85. ResourceGroovyMethods#getPath()

Project: groovy
Source File: ResourceGroovyMethods.java
View license
/**
     * Gets path from a <code>List</code> of <code>String</code>s.
     *
     * @param pathStack     <code>List</code> of <code>String</code>s to be concated as a path.
     * @param separatorChar <code>char</code> to be used as separator between names in path
     * @return <code>String</code>, never <code>null</code>
     */
private static String getPath(final List pathStack, final char separatorChar) {
    final StringBuilder buffer = new StringBuilder();
    final Iterator iter = pathStack.iterator();
    if (iter.hasNext()) {
        buffer.append(iter.next());
    }
    while (iter.hasNext()) {
        buffer.append(separatorChar);
        buffer.append(iter.next());
    }
    return buffer.toString();
}

86. ResourceGroovyMethods#getPath()

View license
/**
     * Gets path from a <code>List</code> of <code>String</code>s.
     *
     * @param pathStack     <code>List</code> of <code>String</code>s to be concated as a path.
     * @param separatorChar <code>char</code> to be used as separator between names in path
     * @return <code>String</code>, never <code>null</code>
     */
private static String getPath(final List pathStack, final char separatorChar) {
    final StringBuilder buffer = new StringBuilder();
    final Iterator iter = pathStack.iterator();
    if (iter.hasNext()) {
        buffer.append(iter.next());
    }
    while (iter.hasNext()) {
        buffer.append(separatorChar);
        buffer.append(iter.next());
    }
    return buffer.toString();
}

87. RangeTest#testIterator()

Project: groovy-core
Source File: RangeTest.java
View license
public void testIterator() {
    Range r = createRange(5, 11);
    int i = 5;
    for (Iterator it = r.iterator(); it.hasNext(); ) {
        assertEquals("equals to " + i, new Integer(i), (Integer) (it.next()));
        i++;
    }
    r = createRange(new BigDecimal("5.0"), new BigDecimal("11.0"));
    BigDecimal one = new BigDecimal("1.0");
    BigDecimal val = new BigDecimal("5.0");
    for (Iterator it = r.iterator(); it.hasNext(); ) {
        assertEquals("equals to " + val, val, (BigDecimal) (it.next()));
        val = val.add(one);
    }
}

88. JobBase#getReport()

Project: hadoop-20
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();
}

89. StreamJob#listJobConfProperties()

Project: hadoop-20
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("====");
}

90. StreamJob#listJobConfProperties()

Project: hadoop-20
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("====");
}

91. JobBase#getReport()

Project: hadoop-common
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();
}

92. 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("====");
}

93. 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();
}

94. 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("====");
}

95. 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;
}

96. EnumerationCanBeIterationInspection#foo()

View license
static void foo(Vector v, Hashtable h) {
    Enumeration e = v.elements();
    while (e.hasMoreElements()) {
        System.out.println(e.nextElement());
    }
    Iterator i = v.iterator();
    while (i.hasNext()) {
        System.out.println(i.next());
    }
    e = h.elements();
    while (e.hasMoreElements()) {
        System.out.println(e.nextElement());
    }
    e = h.keys();
    i = h.values().iterator();
    while (i.hasNext()) {
        System.out.println(i.next());
    }
}

97. HashMapTest#test_entrySet()

Project: j2objc
Source File: HashMapTest.java
View license
/**
     * java.util.HashMap#entrySet()
     */
public void test_entrySet() {
    // Test for method java.util.Set java.util.HashMap.entrySet()
    Set s = hm.entrySet();
    Iterator i = s.iterator();
    assertTrue("Returned set of incorrect size", hm.size() == s.size());
    while (i.hasNext()) {
        Map.Entry m = (Map.Entry) i.next();
        assertTrue("Returned incorrect entry set", hm.containsKey(m.getKey()) && hm.containsValue(m.getValue()));
    }
    Iterator iter = s.iterator();
    s.remove(iter.next());
    assertEquals(1001, s.size());
}

98. LinkedTransferQueueTest#testIterator()

Project: j2objc
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);
}

99. LinkedTransferQueueTest#testIteratorRemove()

Project: j2objc
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());
}

100. CollectionsTest#test_fillLjava_util_ListLjava_lang_Object()

Project: j2objc
Source File: CollectionsTest.java
View license
/**
	 * @tests java.util.Collections#fill(java.util.List, java.lang.Object)
	 */
public void test_fillLjava_util_ListLjava_lang_Object() {
    // java.lang.Object)
    try {
        Collections.fill(null, new Object());
        fail("Expected NullPointerException for null list parameter");
    } catch (NullPointerException e) {
    }
    final int size = ll.size();
    Collections.fill(ll, "k");
    assertEquals("Fill modified list size", size, ll.size());
    Iterator i = ll.iterator();
    while (i.hasNext()) assertEquals("Failed to fill elements", "k", i.next());
    Collections.fill(ll, null);
    assertEquals("Fill with nulls modified list size", size, ll.size());
    i = ll.iterator();
    while (i.hasNext()) assertNull("Failed to fill with nulls", i.next());
}