- Wish me luck
This commit is contained in:
Tristan B. Velloza Kildaire 2023-10-13 09:54:42 +02:00
parent 033faac85c
commit cbb3e45c6e
12 changed files with 33 additions and 18 deletions

1
Basics/Strings/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/target/

View File

@ -162,8 +162,8 @@ public class App
* CLOSING `"""` appear with no whitespace whatsoever before it
*/
str = """
This
is
This
is
""";
System.out.printf("String needing no escaping: '%s'\n", str);
System.out.println("Len of textblock: "+str.length()); //26

1
Basics/basics/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/target/

View File

@ -125,6 +125,8 @@ public class App
ZonedDateTime zonedDateTime = futureDateTime.atZone(ZoneId.of("America/Puerto_Rico"));
System.out.println("Future time (zoned): "+zonedDateTime);
System.out.println("Offsetdatetime: "+zonedDateTime.toOffsetDateTime());
/**
* I'm going to create one in a different time zone now
* but using same date and time.

View File

@ -200,7 +200,7 @@ public class App
*
* (https://en.wikipedia.org/wiki/Heap_pollution)
*/
Integer myInt = intList.get(0);
// Integer myInt = intList.get(0);
/**
* This will work because the actual

View File

@ -3,8 +3,8 @@ package ocp.practice.collections.MoreCollections;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import com.sun.tools.javac.util.List;
/**
* More colelctions practicing
@ -21,6 +21,7 @@ public class App
numbers.add(2);
numbers.add(1);
/**
* Holds a bunch of sorting routines that
* can be applied on collections, such as
@ -69,5 +70,15 @@ public class App
System.out.println("Before sort: "+numbers3);
Collections.sort(numbers3, Comparator.nullsFirst(Comparator.naturalOrder()));
System.out.println("After sort: "+numbers3); // null 1 2 3 4 5
dd(numbers3);
}
public static void dd(List<?> d)
{
}
}

Binary file not shown.

View File

@ -25,7 +25,7 @@ public class App
* Switch case expressions with
* a singular expression
*/
// switchCaseExpressionsSingular();
switchCaseExpressionsSingular();
/**
* Switch case expressions with
@ -41,7 +41,7 @@ public class App
* checks that a yield is present
* PER EACH CASE!
*/
switchCaseExpressionMultiple2();
// switchCaseExpressionMultiple2();
/**
* Switch statements

View File

@ -116,9 +116,9 @@ public class App
*
* The below would print:
*
* 01234567 (followed by) 8901234567
* 01234567 (followed by) 89234567
*
* So it would print out: 012345678901234567
* So it would print out: 0123456789234567
*/
char[] dataOut = new char[8];
while(reader.read(dataOut) != -1)

View File

@ -128,7 +128,7 @@ public class App
if(locale.getLanguage().equals("bogus"))
{
List<Locale> list = new ArrayList<Locale>();
list.add(new Locale("az")); // If no bundle is found for THIS
// list.add(new Locale("az")); // If no bundle is found for THIS
list.add(new Locale("af")); // THEN we try this
// Of course if nothing is found exactly then closest resource bundle is used
// list.add(new Locale("en"));
@ -294,7 +294,7 @@ public class App
*/
DateFormatSymbols symbols = new DateFormatSymbols(currentLocale);
String[] customLongFormMonths = symbols.getMonths();
customLongFormMonths[8] = "Tristan's Birthday Month";
customLongFormMonths[9] = "Tristan's Birthday Month";
symbols.setMonths(customLongFormMonths);
customFormatter2 = new SimpleDateFormat("MMMM", symbols);

View File

@ -29,7 +29,7 @@ public class App
// reductionExamples();
// Stream operations (findFirst, anyMatch, allMatch)
// matchingExamples();
matchingExamples();
// Flat mapping
// flatMapping();
@ -69,16 +69,16 @@ public class App
* value
*/
names = List.of("Tristan", "Thomas", "Abigail", "Andy");
System.out.println(names.stream().collect(Collectors.toMap(App::getFirstLetter, i->i, (i,x)->i+x)));
System.out.println(names.stream().collect(Collectors.toMap(App::getFirstLetter, i->i+"2", (i,x)->i+x)));
var things = new ArrayList<String>();
testMethod(things);
Path p1 = Path.of("/");
Path p2 = Path.of("/././dev2");
System.out.println("IsSameFile?: "+Files.isSameFile(p1, p2));
// Path p1 = Path.of("/");
// Path p2 = Path.of("/././dev2");
//
// System.out.println("IsSameFile?: "+Files.isSameFile(p1, p2));
int i1 = 1;
@ -154,7 +154,7 @@ public class App
* Terminal operation returning the first item
* in the stream
*/
Optional<Integer> optional = stream.parallel().findFirst();
Optional<Integer> optional = stream.parallel().distinct().findAny();
System.out.println(optional.get()); // Finds first element, so 1
/**

View File

@ -189,7 +189,7 @@ public class App
* of collecting all the results of the stream
*/
namesStream = safeNames.parallelStream()
.filter((name) ->
.filter(name ->
{
return name.length() == 4 ||
name.length() == 5;