List of usage examples for java.util LinkedList add
public boolean add(E e)
From source file:com.tulskiy.musique.library.Library.java
public void rescan(Map<String, Object> progress) { List<String> folders = LibraryConfiguration.getFolders(); if (CollectionUtils.isEmpty(folders)) { return;//from w w w. j ava 2 s . c om } progress.put("processing.file", ""); data.removeDeadItems(); HashMap<TrackData, Track> trackDatas = new HashMap<TrackData, Track>(); for (Track track : data) { trackDatas.put(track.getTrackData(), track); } LinkedList<File> queue = new LinkedList<File>(); for (String path : folders) { File f = new File(path); if (f.exists()) queue.add(f); } HashSet<Track> processed = new HashSet<Track>(); final Set<String> formats = Codecs.getFormats(); ArrayList<Track> temp = new ArrayList<Track>(); while (!queue.isEmpty()) { try { File file = queue.pop(); if (progress != null) { if (progress.get("processing.stop") != null) { break; } progress.put("processing.file", file.getAbsolutePath()); } if (file.isDirectory()) { queue.addAll(0, Arrays.asList(file.listFiles(new FileFilter() { @Override public boolean accept(File file) { if (file.isHidden() || !file.canRead()) { return false; } if (file.isDirectory()) return true; String ext = Util.getFileExt(file).toLowerCase(); if (formats.contains(ext)) { String name = Util.removeExt(file.getAbsolutePath()) + ".cue"; return !new File(name).exists(); } return ext.equals("cue"); } }))); } else { TrackData trackData = new TrackData(file.toURI(), 0); Track track = trackDatas.get(trackData); if (track != null) { if (track.getTrackData().getLastModified() != file.lastModified()) { track.getTrackData().clearTags(); TrackIO.getAudioFileReader(file.getName()).reload(track); } processed.add(track); } else { temp.clear(); TrackIO.getAudioFileReader(file.getName()).read(file, temp); for (Track newTrack : temp) { trackData = newTrack.getTrackData(); if (trackDatas.containsKey(trackData)) { // it must be the cue file, so merge the track data trackData.merge(newTrack.getTrackData()); } processed.add(newTrack); } } } } catch (Exception e) { e.printStackTrace(); } } data.clear(); data.addAll(processed); processed.clear(); trackDatas.clear(); rebuildTree(); }
From source file:grails.plugin.cache.web.GenericResponseWrapper.java
@Override public void setHeader(String name, String value) { LinkedList<Serializable> values = new LinkedList<Serializable>(); values.add(value); headersMap.put(name, values);/*from ww w.j a v a 2s . c o m*/ super.setHeader(name, value); }
From source file:grails.plugin.cache.web.GenericResponseWrapper.java
@Override public void setDateHeader(String name, long date) { LinkedList<Serializable> values = new LinkedList<Serializable>(); values.add(date); headersMap.put(name, values);/*from w w w . ja va 2 s . c om*/ super.setDateHeader(name, date); }
From source file:grails.plugin.cache.web.GenericResponseWrapper.java
@Override public void setIntHeader(String name, int value) { LinkedList<Serializable> values = new LinkedList<Serializable>(); values.add(value); headersMap.put(name, values);//from w w w . j av a 2 s . c o m super.setIntHeader(name, value); }
From source file:cn.tata.t2s.ssm.util.AcmeCorpPhysicalNamingStrategy.java
private LinkedList<String> splitAndReplace(String name) { LinkedList<String> result = new LinkedList<>(); for (String part : StringUtils.splitByCharacterTypeCamelCase(name)) { if (part == null || part.trim().isEmpty()) { // skip null and space continue; }//ww w .jav a 2s .co m part = applyAbbreviationReplacement(part); result.add(part.toLowerCase(Locale.ROOT)); } return result; }