/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.function.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
{
List<Foo> list = new ArrayList<>();
list.add(new Foo("Hello"));
list.add(new Foo("World"));
show(list, Foo::getFullName);
}
private static <T> void show(List<T> list, Function<T,String> f) {
for (T t : list) {
System.
out.
println(f.
apply(t
)); }
}
}
class Foo {
public Foo
(String s
) {this.
s = s
;} return s;
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CmltcG9ydCBqYXZhLnV0aWwuZnVuY3Rpb24uKjsKCi8qIE5hbWUgb2YgdGhlIGNsYXNzIGhhcyB0byBiZSAiTWFpbiIgb25seSBpZiB0aGUgY2xhc3MgaXMgcHVibGljLiAqLwpjbGFzcyBJZGVvbmUKewoJcHVibGljIHN0YXRpYyB2b2lkIG1haW4gKFN0cmluZ1tdIGFyZ3MpIHRocm93cyBqYXZhLmxhbmcuRXhjZXB0aW9uCgl7CgkJTGlzdDxGb28+IGxpc3QgPSBuZXcgQXJyYXlMaXN0PD4oKTsKCQlsaXN0LmFkZChuZXcgRm9vKCJIZWxsbyIpKTsKCQlsaXN0LmFkZChuZXcgRm9vKCJXb3JsZCIpKTsKCQlzaG93KGxpc3QsIEZvbzo6Z2V0RnVsbE5hbWUpOwoJfQoJcHJpdmF0ZSBzdGF0aWMgPFQ+IHZvaWQgc2hvdyhMaXN0PFQ+IGxpc3QsIEZ1bmN0aW9uPFQsU3RyaW5nPiBmKSB7CgkJZm9yIChUIHQgOiBsaXN0KSB7CgkJCVN5c3RlbS5vdXQucHJpbnRsbihmLmFwcGx5KHQpKTsKCQl9Cgl9Cn0KCmNsYXNzIEZvbyB7Cglwcml2YXRlIGZpbmFsIFN0cmluZyBzOwoJcHVibGljIEZvbyhTdHJpbmcgcykge3RoaXMucyA9IHM7fQoJcHVibGljIFN0cmluZyBnZXRGdWxsTmFtZSgpIHsKCQlyZXR1cm4gczsKCX0KfQ==