previous | start | next

## Type Bounds

- Type variables can be constrained with type bounds
- Constraints can make a method more useful
- The following method is limited:

      public static <E> void append(ArrayList<E> a, ArrayList<E> b, int count)
      {
         for (int i = 0; i < count && i < b.size(); i++)
            a.add(b.get(i));
      }

  Cannot append an `ArrayList<Rectangle>` to an `ArrayList<Shape>`

previous | start | next