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
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 | |
http://maven.apache.org/xsd/settings-1.0.0.xsd"> | |
<servers> | |
<server> | |
<id>sonatype-nexus-snapshots</id> | |
<username>myusername</username> | |
<password>mypassword</password> | |
</server> |
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
button.addActionListener(e -> { ui.dazzle(e.getModifiers()); }); |
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
button.addActionListener(new ActionListener() { | |
public void actionPerformed(ActionEvent e) { | |
ui.dazzle(e.getModifiers()); | |
} | |
}); |
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
List<String> names = Arrays.asList("Alice", "Bob", "Charlie", "Dave"); | |
List<String> filteredNames = names | |
.filter(e -> e.length() >= 4) | |
.into(new ArrayList<String>()); | |
for (String name : filteredNames) { | |
System.out.println(name); | |
} |
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
List<String> names = Arrays.asList("Alice", "Bob", "Charlie", "Dave"); | |
names | |
.filter(e -> e.length() >= 4) | |
.forEach(e -> { System.out.println(e); }); |
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
List<String> names = Arrays.asList("Alice", "Bob", "Charlie", "Dave"); | |
names | |
.mapped(e -> { return e.length(); }) | |
.asIterable() // returns an Iterable of BiValue elements | |
// an element's key is the person's name, its value is the string length | |
.filter(e -> e.getValue() >= 4) | |
.sorted((a, b) -> a.getValue() - b.getValue()) | |
.forEach(e -> { System.out.println(e.getKey() + '\t' + e.getValue()); }); |
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
Factory<Biscuit> biscuitFactory = Biscuit::new; | |
Biscuit biscuit = biscuitFactory.make(); |
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
interface Accessor<BEAN, PROPERTY> { | |
PROPERTY access(BEAN bean); | |
} | |
public static void main(String[] args) { | |
Address address = new Address("29 Acacia Road", "Tunbridge Wells"); | |
Accessor<Address, String> accessor = Address::getCity; | |
System.out.println(accessor.access(address)); | |
} |
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
executorService.submit(MethodReference::sayHello); | |
private static void sayHello() { | |
System.out.println("hello"); | |
} |
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
Arrays.asList("Alice", "Bob", "Charlie", "Dave").forEach(System.out::println); |