Skip to content

Instantly share code, notes, and snippets.

@boloutaredoubeni
Last active January 3, 2016 21:57
Show Gist options
  • Select an option

  • Save boloutaredoubeni/7be98c5507b74f41b27a to your computer and use it in GitHub Desktop.

Select an option

Save boloutaredoubeni/7be98c5507b74f41b27a to your computer and use it in GitHub Desktop.
Generic Array List with Varying Types
import java.util.List;
import java.util.ArrayList;
public class ArrayListTest {
public static void main(final String[] args) {
List<Object> objectList = new ArrayList<>();
objectList.add(new Object());
objectList.add(new Integer(1));
objectList.add(new String("33213"));
for (final Object obj : objectList ) System.out.println(obj);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment