List of usage examples for java.util Collections sort
@SuppressWarnings("unchecked") public static <T extends Comparable<? super T>> void sort(List<T> list)
From source file:au.org.ala.delta.editor.slotfile.directive.DirOutDependentChars.java
@Override public void writeDirectiveArguments(DirectiveInOutState state) { MutableDeltaDataSet dataSet = state.getDataSet(); List<CharacterDependency> characterDependencies = dataSet.getAllCharacterDependencies(); List<CharacterDependency> controllingVector = checkDependencies(state, characterDependencies); Collections.sort(controllingVector); for (CharacterDependency dependency : controllingVector) { _textBuffer.append(' '); int charNo = dependency.getControllingCharacterId(); _textBuffer.append(charNo).append(','); List<Integer> states = dependency.getStatesAsList(); Collections.sort(states); for (int i = 0; i < states.size(); i++) { if (i != 0) { _textBuffer.append('/'); }/*from w ww. j ava2 s . com*/ _textBuffer.append(states.get(i)); } List<Integer> controlledCharacters = new ArrayList<Integer>(dependency.getDependentCharacterIds()); Collections.sort(controlledCharacters); _textBuffer.append(':'); _textBuffer.append(_deltaWriter.rangeToString(controlledCharacters, ':', '-')); } writeLine(state, _textBuffer.toString()); }
From source file:com.verigreen.collector.common.CommitItemUtils.java
public static Collection<CommitItem> getNotDone() { List<CommitItem> ret = CollectorApi.getCommitItemContainer().findByCriteria(new Criteria<CommitItem>() { @Override/*from w w w. j a va 2 s. co m*/ public boolean match(CommitItem entity) { return !entity.isDone(); } }); Collections.sort(ret); return ret; }
From source file:com.richtodd.android.quiltdesign.block.QuiltContainer.java
public List<QuiltContainerEntry> getEntries(boolean loadThumbnails) throws RepositoryException { ArrayList<QuiltContainerEntry> m_entries = new ArrayList<QuiltContainerEntry>(); for (RepositoryObjectProvider objectProvider : m_provider.getObjects(loadThumbnails)) { QuiltContainerEntry entry = new QuiltContainerEntry(objectProvider.getObjectName(), objectProvider.getLastChangedDate(), objectProvider.getThumbnail()); m_entries.add(entry);//from ww w . j a va 2 s . c o m } Collections.sort(m_entries); return m_entries; }
From source file:cn.clxy.codes.upload.UploadFileService.java
public void retry(Integer... indexes) { // sort first. List<Integer> list = Arrays.asList(indexes); Collections.sort(list); try {/* ww w . j a va 2s .co m*/ doUpload(list); } finally { stop(); } }
From source file:com.richtodd.android.quiltdesign.block.BlockContainer.java
public List<BlockContainerEntry> getEntries(boolean loadThumbnails) throws RepositoryException { ArrayList<BlockContainerEntry> m_entries = new ArrayList<BlockContainerEntry>(); for (RepositoryObjectProvider objectProvider : m_provider.getObjects(loadThumbnails)) { BlockContainerEntry entry = new BlockContainerEntry(objectProvider.getObjectName(), objectProvider.getLastChangedDate(), objectProvider.getThumbnail()); m_entries.add(entry);/*from w ww . j a v a2s . c o m*/ } Collections.sort(m_entries); return m_entries; }
From source file:biz.netcentric.vlt.upgrade.handler.SlingPipesHandler.java
@Override public void execute(InstallContext ctx) throws RepositoryException { this.ctx = ctx; scripts = getScriptsFromConfig();//w w w.j ava 2 s . c o m Collections.sort(scripts.get(ctx.getPhase())); // make sure we're executing in alphabetical order for (String scriptPath : scripts.get(ctx.getPhase())) { runScript(scriptPath); } }
From source file:Main.java
DefaultMutableTreeNode addNodes(DefaultMutableTreeNode curTop, File dir) { String curPath = dir.getPath(); DefaultMutableTreeNode curDir = new DefaultMutableTreeNode(curPath); if (curTop != null) { curTop.add(curDir);/*from www .ja v a2 s . com*/ } List<File> files = new ArrayList<File>(Arrays.asList(dir.listFiles(new FileFilter() { @Override public boolean accept(File pathname) { String name = pathname.getName().toLowerCase(); return name.endsWith(".h") || (pathname.isDirectory() && !("System Volume Information".equalsIgnoreCase(name))); } }))); Collections.sort(files); for (File file : files) { if (file.isDirectory()) { addNodes(curDir, file); } } for (File file : files) { if (file.isFile()) { curDir.add(new DefaultMutableTreeNode(file)); } } return curDir; }
From source file:hmp.HMPRunRemover.java
private void run(String[] args) throws ParseException, ClassNotFoundException, SQLException { cli = getOptions(args);//from ww w.j av a2 s.co m conn = new MySQLConnector("localhost", cli.getOptionValue("db"), cli.getOptionValue("dbUser"), cli.getOptionValue("dbPassword")).getConnection(); int runId = getRunIdFromDate(); System.out.println("Deleting data for " + cli.getOptionValue("date") + ", id = " + runId); ArrayList<Integer> samples = getSamplesForRun(runId); System.out.println("Samples " + Arrays.toString(samples.toArray())); Collections.sort(samples); deleteRpdResultData(samples); deleteRdpSummaryData(samples); deleteSampleData(samples); deleteRunData(runId); deleteSampleCounts(samples); deleteSample(runId); deleteRunCounts(runId); deleteRun(runId); }
From source file:org.ambraproject.solr.SolrFieldConversionImpl.java
@Required public void setViewCountingFields(Map<Integer, String> viewCountingFields) { this.viewCountingFields = viewCountingFields; sortedDays = new ArrayList<Integer>(); sortedDays.addAll(viewCountingFields.keySet()); Collections.sort(sortedDays); maxDaysToCountViews = sortedDays.get(sortedDays.size() - 1); }
From source file:com.skcraft.launcher.auth.AccountList.java
/** * Add a new account./*ww w. j a va 2s. c o m*/ * * <p>If there is already an existing account with the same ID, then the * new account will not be added.</p> * * @param account the account to add */ public synchronized void add(@NonNull Account account) { if (!accounts.contains(account)) { accounts.add(account); Collections.sort(accounts); fireContentsChanged(this, 0, accounts.size()); } }