Skip to content

Instantly share code, notes, and snippets.

View brilianfird's full-sized avatar

Brilian Firdaus brilianfird

View GitHub Profile
@Test
public void initializeOptional_optionalOf() {
Optional<String> helloWorldOptional = Optional.of("Hello, world");
assert helloWorldOptional.isPresent();
assert "Hello, world".equals(helloWorldOptional.get());
}
public SimpleStream<T> map(Function<T, T> function) {
List<T> returnValueList = new ArrayList<>();
for (T value : values) {
returnValueList.add(value + " String");
}
this.values = returnValueList;
return this;
}
package com.example.functional.programming.intf;
import com.example.functional.programming.model.Person;
@FunctionalInterface
public interface PersonFunctionalInterface {
Person createPerson(String name);
default String getDefaultMethodString() {
package com.example.functional.programming.model;
public class Person {
private String name;
public String getName() {
return name;
}