Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file removed .gradle/7.1.1/executionHistory/executionHistory.lock
Binary file not shown.
Binary file removed .gradle/7.1.1/fileHashes/fileHashes.lock
Binary file not shown.
Binary file added .gradle/7.3.1/checksums/checksums.lock
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added .gradle/7.3.1/fileHashes/fileHashes.lock
Binary file not shown.
File renamed without changes.
Binary file modified .gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
4 changes: 2 additions & 2 deletions .gradle/buildOutputCleanup/cache.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#Tue Sep 06 23:25:57 CDT 2022
gradle.version=7.1.1
#Mon Oct 03 20:33:21 CDT 2022
gradle.version=7.3.1
Binary file added bin/main/com/oracle/arrays/DynamicArrayList.class
Binary file not shown.
Binary file added bin/main/com/oracle/arrays/Multidimensional.class
Binary file not shown.
Binary file added bin/main/com/oracle/arrays/Unidimensional.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added bin/main/com/oracle/arrays/model/Posicion.class
Binary file not shown.
Binary file added bin/main/com/oracle/stream/Person.class
Binary file not shown.
Binary file added bin/main/com/oracle/stream/StreamEjemplo.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added bin/test/com/oracle/arrays/UnidimensionalTest.class
Binary file not shown.
5 changes: 3 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#Mon Oct 03 20:33:09 CDT 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-bin.zip
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
69 changes: 63 additions & 6 deletions src/main/java/com/oracle/stream/StreamEjemplo.java
Original file line number Diff line number Diff line change
@@ -1,24 +1,40 @@
package com.oracle.stream;

import java.text.Format;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Currency;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.stream.Collectors;

public class StreamEjemplo {
public static void main(String[] args) {

List<Person> personList = new ArrayList<Person>();
public static void main(String[] args) {
List<Person> personList = new ArrayList<Person>();
personList.add(new Person("Tom", 8900, 23, "male", "New York"));
personList.add(new Person("Jack", 7000, 25, "male", "Washington"));
personList.add(new Person("Lily", 7800, 21, "female", "Washington"));
personList.add(new Person("Anni", 8200, 24, "female", "New York"));
personList.add(new Person("Owen", 9500, 25, "male", "New York"));
personList.add(new Person("Alisa", 7900, 26, "female", "New York"));

/*
Segun yo no se puede crear nuevos elementos en el map, ya que es una tranformación de los elementos de la lista existente
*/
// Crear una nueva persona y agregarla a la lista
List<Person> personList2 = personList.stream().map().collect(Collectors.toList());
// Person nPerson = new Person("Alan", 10000, 23, "male", "Abasoliwood");
//List<Person> personList2 = personList.stream().map( p -> p).collect(Collectors.toList());

// Convertir km a millas
List<Person> personList3 = personList2.stream().map().collect(Collectors.toList());
List<Person> personList3 = personList.stream().map(p -> {
p.setKmPerYear( (int)(p.getKmPerYear() * 0.621371));
return p;
}).collect(Collectors.toList());
for (Person person : personList3) {
System.out.println(person.getKmPerYear());
}
}
}

Expand All @@ -36,4 +52,45 @@ public Person(String name, int kmPerYear, int age, String genre, String city) {
this.genre = genre;
this.city = city;
}

public String getName() {
return this.name;
}

public void setName(String name) {
this.name = name;
}

public int getKmPerYear() {
return this.kmPerYear;
}

public void setKmPerYear(int kmPerYear) {
this.kmPerYear = kmPerYear;
}

public int getAge() {
return this.age;
}

public void setAge(int age) {
this.age = age;
}

public String getGenre() {
return this.genre;
}

public void setGenre(String genre) {
this.genre = genre;
}

public String getCity() {
return this.city;
}

public void setCity(String city) {
this.city = city;
}

}