Skip to content

Instantly share code, notes, and snippets.

@flyakite
Last active November 19, 2019 10:03
Show Gist options
  • Save flyakite/832a6b9f48d9725d2c82b8d88a4f8d89 to your computer and use it in GitHub Desktop.
Save flyakite/832a6b9f48d9725d2c82b8d88a4f8d89 to your computer and use it in GitHub Desktop.
Test
import java.util.function.BiFunction;
public class Main {
public static void main(String args[])
{
BiFunction<Integer, Integer, Integer> composite1 = (a, b) -> a + b;
composite1 = composite1.andThen(a -> 2 * a);
System.out.println("Composite1 = " + composite1.apply(2, 3));
}
}
// What is the output?
List<?> listOfAnyType;
List<Object> listOfObject = new ArrayList<Object>();
List<String> listOfString = new ArrayList<String>();
List<Integer> listOfInteger = new ArrayList<Integer>();
// Which of the following assignment is legal?
listOfAnyType = listOfString;
listOfAnyType = listOfInteger;
listOfObjectType = (List<Object>) listOfString;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment