当前位置: 首页>>代码示例>>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;未经允许,请勿转载。