Last active
January 3, 2016 21:57
-
-
Save boloutaredoubeni/7be98c5507b74f41b27a to your computer and use it in GitHub Desktop.
Generic Array List with Varying Types
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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