Skip to content

Tag: java

Unable to parse date which is missing minutes?

I am trying to parse a date-time string that does not contain minutes 2019-10-12T07Z. When I run the above code, it throws the following exception stack trace Expected output Any idea what I should do? Answer You have to create custom DateTimeFormatter representing the time and offset. See that code run at Id…

Retrieve all queue data in for loop

I have the following code which works fine but I am struggling to figure out how to retrieve the last value in the queue. Here is the output: Answer Since you’re incrementing x and decreasing the size of the queue, x will eventually become bigger than the remaining queue size before the queue is empty. …

elastic search – Java api client range query

I am migrating a java application from elastic search high level client to java api client. There is a range query like this in the code. QueryBuilders.rangeQuery(“startDate”).lte(dateUtils.today()) Need to change this to java api client code. Could someone help on this? Answer https://www.elastic…

Program is having issues with inputting arrays

The output for the following code is: Please enter your words: hello, keshav, bob, doan kehsavbob Exception in thread “main” java.lang.NumberFormatException: For input string: “kehsavbob” at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67) at java…

Avoid platform specific dependencies in SBT packageBin

In a Java11 project (actually Java Play-Framework) I depend directly on org.deeplearning4j:deeplearning4j-nlp:1.0.0-M2 in my build.sbt running SBT 1.5.5. That dependency transitively depends on several other libraries (like e.g. org.bytedeco:ffmpeg:5.0-1.5.7) that exists as platform dependent libraries and se…

Mapping List to DynamoDB

I’m trying to map to DynamoDB list of dates in Java I have written my own converter but it works only for LocalDateTime but not for the List. Does anyone know how to do it correctly? Should I write separate converter that will return list of strings where each string will be converted from localdatetime…