Skip to content

Commit

Permalink
Alterado tipo das listas para String conforme solicitiado no Exercício
Browse files Browse the repository at this point in the history
  • Loading branch information
logonrm authored and jmarcelocjr committed Nov 15, 2017
1 parent ccb02d5 commit 642280b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions SCJ Fundamentos Aula 4/src/ex1/TestePerformance.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,27 @@ public class TestePerformance {

public static void main(String[] args) {

ArrayList<Integer> lista1 = new ArrayList<>();
LinkedList<Integer> lista2 = new LinkedList<>();
ArrayList<String> lista1 = new ArrayList<>();
LinkedList<String> lista2 = new LinkedList<>();

LocalDateTime inicio = LocalDateTime.now();

for (int i = 1; i <= 1000000; i++) {
lista1.add(i);
lista1.add("String: " + i);
}

LocalDateTime fim = LocalDateTime.now();

long tempoInsercao = ChronoUnit.MILLIS.between(inicio, fim);
System.out.println("Tempo de Inserção [ArrayList]: " + tempoInsercao);
System.out.println("Tempo de Inserção [ArrayList]: " + tempoInsercao);

inicio = LocalDateTime.now();
for (int i = 1; i <= 1000000; i++) {
lista2.add(i);
lista2.add("String: " + i);
}
fim = LocalDateTime.now();
tempoInsercao = ChronoUnit.MILLIS.between(inicio, fim);
System.out.println("Tempo de Inserção [LinkedList]: " + tempoInsercao);
System.out.println("Tempo de Inserção [LinkedList]: " + tempoInsercao);

inicio = LocalDateTime.now();
lista1.get(500000);
Expand Down

0 comments on commit 642280b

Please sign in to comment.