This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Careful use of concurrency is particularly important to the Swing programmer. A well-written Swing program uses concurrency to create a user interface that never "freezes" — the program is always responsive to user interaction, no matter what it's doing. To create a responsive program, the programmer must learn how the Swing framework employs threads. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static java.util.List<FileItem> listDirectoryAppend(File dir, java.util.List<FileItem> lista) { | |
if (dir.isDirectory()) { | |
String[] filhos = dir.list(); | |
for (int i = 0; i < filhos.length; i++) { | |
File nome = new File(dir, filhos[i]); | |
if (nome.isFile()) { | |
if (nome.getName().toUpperCase().endsWith(".GBK")) { | |
lista.add(new FileItem(nome)); | |
} | |
} else if (nome.isDirectory()) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Map<Integer, String> map = ... | |
Iterator<Map.Entry<Integer, String>> it = map.entrySet().iterator(); | |
while (it.hasNext()) { | |
Map.Entry<Integer, String> entry = it.next(); | |
// Remove entry if key is null or equals 0. | |
if (entry.getKey() == null || entry.getKey() == 0) { | |
it.remove(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String target = "FOOBar"; | |
target = target.replaceAll("(?i)foo", ""); | |
System.out.println(target); |