Skip to content

Instantly share code, notes, and snippets.

@yusuke
Created October 7, 2014 15:47
Show Gist options
  • Save yusuke/ba777e49ba3e8d3f8d03 to your computer and use it in GitHub Desktop.
Save yusuke/ba777e49ba3e8d3f8d03 to your computer and use it in GitHub Desktop.
public class Cpu {
public static void main(String[] args) throws TwitterException {
Twitter twitter = TwitterFactory.getSingleton();
// with lambda
IntStream.rangeClosed('a', 'Z').forEach(e -> {
try {
twitter.updateStatus(String.format("@syobochim %sカップ", (char) e));
} catch (TwitterException e1) {
e1.printStackTrace();
}
});
// without lambda
for (char c = 'a'; c <= 'z'; c++) {
twitter.updateStatus(String.format("@syobochim %sカップ", c));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment