JDK 9 List.of(...)
// JDK 9 写法: List.of(...)
// List<Point> polygon = List.of(new Point(0, 0), new Point(0, 4), new Point(4, 4), new Point(4, 0));// JDK 1.6 写法:使用ArrayList并手动add元素List<Point> polygon = new ArrayList<Point>();polygon.add(new Point(0, 0));polygon.add(new Point(0, 4));polygon.add(new Point(4, 4));polygon.add(new Point(4, 0));
JDK 9 List.of(...)
JDK 1.6 boolean add(E e);

/*** Appends the specified element to the end of this list (optional* operation).** <p>Lists that support this operation may place limitations on what* elements may be added to this list. In particular, some* lists will refuse to add null elements, and others will impose* restrictions on the type of elements that may be added. List* classes should clearly specify in their documentation any restrictions* on what elements may be added.** @param e element to be appended to this list* @return <tt>true</tt> (as specified by {@link Collection#add})* @throws UnsupportedOperationException if the <tt>add</tt> operation* is not supported by this list* @throws ClassCastException if the class of the specified element* prevents it from being added to this list* @throws NullPointerException if the specified element is null and this* list does not permit null elements* @throws IllegalArgumentException if some property of this element* prevents it from being added to this list*/boolean add(E e);