本文整理匯總了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;
}
示例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();
}
示例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();
}
}
示例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+")"));
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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(" ");
}
cell.setAlign("left");
} else {
cell.addContent(" ");
}
return(cell); }
示例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;
}
示例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();
}
}
}
示例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]"));
}
}
示例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;
}
示例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();
}
}
示例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);
}
}