Created
August 8, 2016 12:56
-
-
Save loiane/3d0e2a89f8ed5447dad2b8dc9075df7e to your computer and use it in GitHub Desktop.
This file contains 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.ArrayList; | |
import java.util.LinkedList; | |
public class ArrayELinkedList { | |
public static void main(String[] args) { | |
ArrayList<LinkedList<String>> arrayList = new ArrayList<>(); | |
LinkedList<String> linked01 = new LinkedList<>(); | |
linked01.add("A"); | |
linked01.add("B"); | |
LinkedList<String> linked02 = new LinkedList<>(); | |
linked02.add("C"); | |
arrayList.add(linked01); | |
arrayList.add(linked02); | |
//acessando o "B" | |
if (arrayList.get(0) != null){ //é sempre bom verificar antes de usar | |
System.out.println(arrayList.get(0).get(1)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment