當前位置: 首頁>>代碼示例>>Java>>正文


Java TreeSet.iterator方法代碼示例

本文整理匯總了Java中java.util.TreeSet.iterator方法的典型用法代碼示例。如果您正苦於以下問題:Java TreeSet.iterator方法的具體用法?Java TreeSet.iterator怎麽用?Java TreeSet.iterator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.util.TreeSet的用法示例。


在下文中一共展示了TreeSet.iterator方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: deduceSuperTypes

import java.util.TreeSet; //導入方法依賴的package包/類
private ElementHandle[] deduceSuperTypes(TypeElement subTypeElement, 
        CompilationController compCtlr){

    TypeMirror subtypeMirror = subTypeElement.asType();
    Types types = compCtlr.getTypes();
    Comparator<TypeMirror> comparator = new TypeMirrorComparator();
    //TODO:The working set (workingTypeMirrors) doesn't have to be a TreeSet. 
    //Why unnecessarily do the additional work of ordering in an intermediate Set?
    TreeSet<TypeMirror> finalSuperTypeMirrors = new TreeSet<TypeMirror>(comparator);
    TreeSet<TypeMirror> workingTypeMirrors = new TreeSet<TypeMirror>(comparator);
    workingTypeMirrors.add(subtypeMirror);
    getAllSuperIFs(subtypeMirror, workingTypeMirrors, finalSuperTypeMirrors,
            compCtlr);
    ElementHandle[] superTypeHandles = new ElementHandle[finalSuperTypeMirrors.size()];
    int index = 0;
    for (Iterator<TypeMirror> it = finalSuperTypeMirrors.iterator(); it.hasNext();) {
        TypeMirror typeMirror = it.next();
        superTypeHandles[index++] = ElementHandle.create(types.asElement(typeMirror));
    }
    return superTypeHandles;

}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:23,代碼來源:UseSuperTypeRefactoring.java

示例2: instructorText

import java.util.TreeSet; //導入方法依賴的package包/類
public String instructorText(String instructorNameFormat, String separator){
	if (getClassInstructors() == null) return "";
	
	TreeSet sortedInstructors = new TreeSet(new InstructorComparator());
	sortedInstructors.addAll(this.getClassInstructors());

	StringBuffer sb = new StringBuffer();
	
	for (Iterator it = sortedInstructors.iterator(); it.hasNext();) {
		ClassInstructor ci = (ClassInstructor) it.next();
		sb.append(ci.getInstructor().getName(instructorNameFormat));
		if (it.hasNext()) sb.append(separator);
	}
	
	return sb.toString();
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:17,代碼來源:Class_.java

示例3: iterator

import java.util.TreeSet; //導入方法依賴的package包/類
/**
 * @return
 */
public Iterator<String> iterator()
{
    if (keyToValue == null)
    {
        return null;
    }
    else
    {
        // put them in a treeset first to sort them
        TreeSet<String> treeSet = new TreeSet<String>(keyToValue.values());

        if (hasEmptyValue)
        {
            treeSet.add("");
        }

        return treeSet.iterator();
    }
}
 
開發者ID:GlennioTech,項目名稱:MetadataEditor,代碼行數:23,代碼來源:StringHashMap.java

示例4: coumputeSubparts

import java.util.TreeSet; //導入方法依賴的package包/類
protected void coumputeSubparts(String courseOfferingId, PrintWriter out) throws Exception {
    if (courseOfferingId==null || courseOfferingId.length()==0 || courseOfferingId.equals(Preference.BLANK_PREF_VALUE)) return;
    TreeSet subparts = new TreeSet(new SchedulingSubpartComparator(null));
    subparts.addAll(new SchedulingSubpartDAO().
        getSession().
        createQuery("select distinct s from " +
                "SchedulingSubpart s inner join s.instrOfferingConfig.instructionalOffering.courseOfferings co "+
                "where co.uniqueId = :courseOfferingId").
        setFetchSize(200).
        setCacheable(true).
        setLong("courseOfferingId", Long.parseLong(courseOfferingId)).
        list());
    for (Iterator i=subparts.iterator();i.hasNext();) {
        SchedulingSubpart s = (SchedulingSubpart)i.next();
        String id = s.getUniqueId().toString();
        String name = s.getItype().getAbbv();
        String sufix = s.getSchedulingSubpartSuffix();
        while (s.getParentSubpart()!=null) {
            name = "_"+name;
            s = s.getParentSubpart();
        }
        if (s.getInstrOfferingConfig().getInstructionalOffering().getInstrOfferingConfigs().size()>1)
            name += " ["+s.getInstrOfferingConfig().getName()+"]";
        print(out, id, name+(sufix==null || sufix.length()==0?"":" ("+sufix+")"));
    }
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:27,代碼來源:DistributionPrefsAjax.java

示例5: print

import java.util.TreeSet; //導入方法依賴的package包/類
public static boolean print(OutputStream out, Collection<SubjectArea> subjectAreas) throws IOException, DocumentException {
    TreeSet courses = new TreeSet(new Comparator() {
        public int compare(Object o1, Object o2) {
            CourseOffering co1 = (CourseOffering)o1;
            CourseOffering co2 = (CourseOffering)o2;
            int cmp = co1.getCourseName().compareTo(co2.getCourseName());
            if (cmp != 0) return cmp;
            return co1.getUniqueId().compareTo(co2.getUniqueId());
        }
    });
    String subjectIds = "";
    for (SubjectArea sa: subjectAreas)
    	subjectIds += (subjectIds.isEmpty() ? "" : ",") + sa.getUniqueId();
    courses.addAll(SessionDAO.getInstance().getSession().createQuery(
    		"select co from CourseOffering co where  co.subjectArea.uniqueId in (" + subjectIds + ")").list());
    if (courses.isEmpty()) return false;
    PdfWorksheet w = new PdfWorksheet(out, subjectAreas, null);
    for (Iterator i=courses.iterator();i.hasNext();) {
        w.print((CourseOffering)i.next());
    }
    w.lastPage();
    w.close();
    return true;
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:25,代碼來源:PdfWorksheet.java

示例6: pdfBuildExamPeriod

import java.util.TreeSet; //導入方法依賴的package包/類
private PdfPCell pdfBuildExamPeriod(ExamAssignmentProxy examAssignment, TreeSet exams, boolean isEditable) {
    StringBuffer sb = new StringBuffer();
    for (Iterator i=exams.iterator();i.hasNext();) {
        Exam exam = (Exam)i.next();
        if (examAssignment!=null && examAssignment.getExamTypeId().equals(exam.getExamType().getUniqueId())) {
            ExamAssignment ea = examAssignment.getAssignment(exam.getUniqueId());
            if (ea==null && !isShowExamName()) continue;
            sb.append(ea==null?"":ea.getPeriodAbbreviation());
        } else {
            if (exam.getAssignedPeriod()==null && !isShowExamName()) continue;
            sb.append(exam.getAssignedPeriod()==null?"":exam.getAssignedPeriod().getAbbreviation());
        }
        if (i.hasNext()) sb.append("\n");
    }
    Color color = (isEditable?sEnableColor:sDisableColor);
    PdfPCell cell = createCell();
    addText(cell, sb.toString(), false, false, Element.ALIGN_LEFT, color, true);
    return cell;
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:20,代碼來源:PdfInstructionalOfferingTableBuilder.java

示例7: csvBuildExamPeriod

import java.util.TreeSet; //導入方法依賴的package包/類
private CSVField csvBuildExamPeriod(ExamAssignmentProxy examAssignment, TreeSet exams, boolean isEditable) {
    StringBuffer sb = new StringBuffer();
    for (Iterator i=exams.iterator();i.hasNext();) {
        Exam exam = (Exam)i.next();
        if (examAssignment!=null && examAssignment.getExamTypeId().equals(exam.getExamType().getUniqueId())) {
            ExamAssignment ea = examAssignment.getAssignment(exam.getUniqueId());
            if (ea==null && !isShowExamName()) continue;
            sb.append(ea==null?"":ea.getPeriodAbbreviation());
        } else {
            if (exam.getAssignedPeriod()==null && !isShowExamName()) continue;
            sb.append(exam.getAssignedPeriod()==null?"":exam.getAssignedPeriod().getAbbreviation());
        }
        if (i.hasNext()) sb.append("\n");
    }
    
    CSVField cell = createCell();
    addText(cell, sb.toString(), true);
    return cell;
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:20,代碼來源:CsvInstructionalOfferingTableBuilder.java

示例8: pdfBuildInstructor

import java.util.TreeSet; //導入方法依賴的package包/類
protected PdfPCell pdfBuildInstructor(PreferenceGroup prefGroup, boolean isEditable){
	Color color = (isEditable?sEnableColor:sDisableColor);
	PdfPCell cell = createCell();
	
	if (prefGroup instanceof Class_) {
		Class_ aClass = (Class_) prefGroup;
    	TreeSet sortedInstructors = new TreeSet(new InstructorComparator());
    	sortedInstructors.addAll(aClass.getClassInstructors());
		for (Iterator i=sortedInstructors.iterator(); i.hasNext();) {
			ClassInstructor ci = (ClassInstructor)i.next();
    		String label = ci.getInstructor().getName(getInstructorNameFormat());
    		if (ci.getResponsibility() != null && ci.getResponsibility().getAbbreviation() != null && !ci.getResponsibility().getAbbreviation().isEmpty())
    			label += " (" + ci.getResponsibility().getAbbreviation() + ")";
    		boolean italic = !aClass.isDisplayInstructor().booleanValue();
    		boolean bold = ci.isLead().booleanValue();
    		addText(cell, label, bold, italic, Element.ALIGN_LEFT, color, true);
		}
	}
	
    return cell;
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:22,代碼來源:PdfInstructionalOfferingTableBuilder.java

示例9: buildInstructor

import java.util.TreeSet; //導入方法依賴的package包/類
@Override
protected TableCell buildInstructor(PreferenceGroup prefGroup, boolean isEditable){
	TableCell cell = this.initNormalCell("" ,isEditable);
	if (prefGroup instanceof Class_) {
		Class_ aClass = (Class_) prefGroup;
		if (aClass.isDisplayInstructor() && !aClass.getClassInstructors().isEmpty()) {
        	TreeSet sortedInstructors = new TreeSet(new InstructorComparator());
        	sortedInstructors.addAll(aClass.getClassInstructors());
    		for (Iterator i=sortedInstructors.iterator(); i.hasNext();) {
    			ClassInstructor ci = (ClassInstructor)i.next();
        		String label = ci.getInstructor().getName(getInstructorNameFormat());
        		cell.addContent(label + (i.hasNext() ? "<br>" : ""));
    		}
		} else {
			cell.addContent(" &nbsp; ");
		}
        cell.setAlign("left");	
	} else {
		cell.addContent(" &nbsp; ");
	}
    return(cell);    }
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:22,代碼來源:WebClassAssignmentReportListTableBuilder.java

示例10: findAll

import java.util.TreeSet; //導入方法依賴的package包/類
public static TreeSet<DepartmentStatusType> findAll(int apply) {
	TreeSet<DepartmentStatusType> ret = findAll();
	for (Iterator<DepartmentStatusType> i=ret.iterator();i.hasNext();) {
		DepartmentStatusType t = i.next();
		if (!t.apply(apply)) i.remove();
	}
	return ret;
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:9,代碼來源:DepartmentStatusType.java

示例11: sendCrashReportsToServer

import java.util.TreeSet; //導入方法依賴的package包/類
private void sendCrashReportsToServer(Context ctx) {
    String[] crFiles = getCrashReportFiles(ctx);
    if (crFiles != null && crFiles.length > 0) {
        TreeSet<String> sortedFiles = new TreeSet();
        sortedFiles.addAll(Arrays.asList(crFiles));
        Iterator it = sortedFiles.iterator();
        while (it.hasNext()) {
            File cr = new File(ctx.getFilesDir(), (String) it.next());
            postReport(cr);
            cr.delete();
        }
    }
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:14,代碼來源:CrashHandler.java

示例12: coumputeExams

import java.util.TreeSet; //導入方法依賴的package包/類
protected void coumputeExams(String courseOfferingId, Long examType, PrintWriter out) throws Exception {
    if (courseOfferingId==null || courseOfferingId.length()==0 || courseOfferingId.equals(Preference.BLANK_PREF_VALUE)) return;
    TreeSet exams = new TreeSet(Exam.findExamsOfCourseOffering(Long.valueOf(courseOfferingId),examType));
    if (exams.size()>1 || exams.isEmpty())
        print(out, "-1", "-");
    for (Iterator i=exams.iterator();i.hasNext();) {
        Exam exam = (Exam)i.next();
        print(out, exam.getUniqueId().toString(), exam.getLabel().replaceAll("&","@[email protected]")); 
    }
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:11,代碼來源:DistributionPrefsAjax.java

示例13: getInstructors

import java.util.TreeSet; //導入方法依賴的package包/類
private List<Instructor> getInstructors(Class_ clazz) {
    if (!clazz.isDisplayInstructor().booleanValue()) return null;
    List<Instructor> ret = new ArrayList<Instructor>();
    TreeSet ts = new TreeSet(clazz.getClassInstructors());
    NameFormat nameFormat = NameFormat.fromReference(ApplicationProperty.OnlineSchedulingInstructorNameFormat.value());
    for (Iterator i=ts.iterator();i.hasNext();) {
        ClassInstructor ci = (ClassInstructor)i.next();
        if (!ci.isLead().booleanValue()) continue;
        ret.add(new Instructor(ci.getInstructor().getUniqueId(), ci.getInstructor().getExternalUniqueId(), nameFormat.format(ci.getInstructor()), ci.getInstructor().getEmail()));
    }
    return ret;
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:13,代碼來源:StudentSectioningDatabaseLoader.java

示例14: iterator

import java.util.TreeSet; //導入方法依賴的package包/類
/**
 * @return
 */
public Iterator<String> iterator() {
    if (keyToValue == null) {
        return null;
    } else {
        // put them in a treeset first to sort them
        TreeSet<String> treeSet = new TreeSet<String>(keyToValue.values());

        if (hasEmptyValue) {
            treeSet.add("");
        }

        return treeSet.iterator();
    }
}
 
開發者ID:openaudible,項目名稱:openaudible,代碼行數:18,代碼來源:StringHashMap.java

示例15: rollForwardExamPeriods

import java.util.TreeSet; //導入方法依賴的package包/類
private void rollForwardExamPeriods(Session toSession, Session fromSession){	
	ExamPeriod fromExamPeriod = null;
	ExamPeriod toExamPeriod = null;
	ExamPeriodDAO examPeriodDao = new ExamPeriodDAO();
	TreeSet examPeriods = ExamPeriod.findAll(fromSession.getUniqueId(), (Long)null);
	for(Iterator examPeriodIt = examPeriods.iterator(); examPeriodIt.hasNext();){
		fromExamPeriod = (ExamPeriod)examPeriodIt.next();
		toExamPeriod = (ExamPeriod)fromExamPeriod.clone();
		toExamPeriod.setSession(toSession);
		if (toExamPeriod.getEventStartOffset()==null) toExamPeriod.setEventStartOffset(0);
		if (toExamPeriod.getEventStopOffset()==null) toExamPeriod.setEventStopOffset(0);
		examPeriodDao.save(toExamPeriod);
	}
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:15,代碼來源:SessionRollForward.java


注:本文中的java.util.TreeSet.iterator方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。