What to do with Stream.of < Foo (1, "1") > return List

description:

Stream passes in a set of numbers and then processes the output of other types

is equivalent to the following code:

//method
List<Foo> fooList = new ArrayList<>();
for (Integer i: Arrays.asList(1, 2, 3)) {
    fooList.add(new Foo(i, i.toString()));
}
return fooList;
//method
//Foo
class Foo(int i, String s){}

after searching, I didn"t find anything like this, usually the one with the same input and output.

Dec.12,2021

problem solved
uses Stream.map (Function < T, R >) to handle.
integer is input , new Foo (integer, integer.toString ()) is output .

List < Foo > foos = Stream.of (1,2,3) .map (integer-> new Foo (integer, integer.toString (). Collect (Collectors.toList ());
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b377f6-2c0c8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b377f6-2c0c8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?