Why Instant.parse() string with timezone behaviour in java8 is different than java 17

The following code snippet Instant.parse("2023-08-08T00:00:00+02:00") compiles and executes as expected in java-17. But when executed with java-8, throws the following exception java.time.format.DateTimeParseException: Text ‘2023-08-01T00:00:00+02:00’ could not be parsed at index 19 at java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:1949) at java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1851) at java.time.Instant.parse(Instant.java:395) … My question is why? Did something change in java.time api? Please note, i do know a way… Read More Why Instant.parse() string with timezone behaviour in java8 is different than java 17

Where Are JanusGraph's Vertexes In Cassandra?

Where does Apache Cassandra put its JanusGraph Vertexes? By no means an expert question, I’m a newbie and I know it. Rusty in some areas, too. I’m a beginner in JanusGraph, Cassandra, and asking questions on Stack Overflow. I have nowhere near the number of experiences as expert engineers-and-developers or experienced-and-consistent Stack Overflow authors. Reproduction… Read More Where Are JanusGraph's Vertexes In Cassandra?

Dynamic Class Data Sharing not using the archive file

We are trying to use Dynamic Class Data Sharing (Dynamic CDS) with our spring boot application. Created the CDS archive using the following command java -Xlog:cds -XX:DumpLoadedClassList=cds.jsa -jar app-0.0.1-SNAPSHOT.jar And trying to use the archive using the following command java -Xlog:cds -XX:SharedArchiveFile=cds.jsa -jar app-0.0.1-SNAPSHOT.jar But getting the following error in the beginning of the application… Read More Dynamic Class Data Sharing not using the archive file

Why have nothing to override, but still can put @Override without syntax error?

I am using Java language level 17 on JDK 19. I have package ocp17.ch07; public record BeardedDragon(boolean fun) { @Override public boolean fun() { return false; } } Why have nothing to override, but still can put @Override without syntax error? >Solution : You are indeed overriding the fun method (which is bad in this… Read More Why have nothing to override, but still can put @Override without syntax error?

DateTimeFormatter fails to parse a date in JDK 17 where as passes in JDK8

Here is the code snippet String date = "Wed, 20 Feb 2019 07:14:06 +0100"; DateTimeFormatter formatter = DateTimeFormatter.ofPattern("EEE, d MMM yyyy HH:mm:ss Z"); System.out.println(ZonedDateTime.parse(date, formatter).toString()); This code works fine with JDK8 where as fails in JDK17 with the following exception Text ‘Wed, 20 Feb 2019 07:14:06 +0100’ could not be parsed at index 0 java.time.format.DateTimeParseException:… Read More DateTimeFormatter fails to parse a date in JDK 17 where as passes in JDK8

More optimal solution?

I write this code to find the youngest person : import java.util.Comparator; import java.util.List; public class PersonImpl implements PersonInterface { @Override public Person youngest(List<Person> personList) { Integer minAge = personList.stream() .map(Person::getAge) .min(Comparator.comparing(Integer::valueOf)) .orElse(null); return personList.stream() .filter(person -> person.getAge() == minAge) .toList() .stream() .findFirst() .orElse(null); } } As you can see I did it and is… Read More More optimal solution?

Create menu using Map but to remove the { } and ", "

I have this menu created : @SuppressWarnings("MismatchedQueryAndUpdateOfCollection") HashMap<Integer, String> menu = new HashMap<>(); menu.put(1, "Show clients from banks" + "\n"); menu.put(2, "Create new bank" + "\n"); menu.put(3, """ \t. "Choose a bank from where you want to see the clients: A. BNP B. ING C. KBC \s"""); System.out.println(menu); and I get the output bit as… Read More Create menu using Map but to remove the { } and ", "

Return city in which most people live – stream()

I have a class called Person (name,surname,city,age) and I added to it persons. I have to find the city that lives the most people – in my case is "Meerdonk". I tried using stream(), but I cannot figure out how. This is my code: public static Optional<Person> getMostPopulateCity(List<Person> personList) { return personList.stream() .filter(person -> person.getCity()… Read More Return city in which most people live – stream()