Posts by Marcos Costa Pinto • 211 points
5 posts
-
0
votes1
answer471
viewsA: Handling Hours with Joda Time
Using Jodatime I believe that the following function would solve your problem: private DateTime somarTempos(DateTime t1, DateTime t2) { return t1.plusHours(t2.getHourOfDay())…
-
0
votes0
answers383
viewsQ: @Retryable and @Async com spring
It is possible to create an asynchronous method that can be tried again if some exception occurs with spring? @Retryable @Async public void myMethod() throws Exception { // Do some stuff }…
-
6
votes2
answers2837
viewsA: How to clear a vector?
I can’t comment yet. I agree with the statement @Piovezan: "Clearing" the vector in this case is not exactly possible, because it is saving integers and not references that could receive the null…
javaanswered Marcos Costa Pinto 211 -
1
votes2
answers1151
viewsA: Java Desktop Application Root Directory
You can use String path = new File(".").getCanonicalPath(); for this.
javaanswered Marcos Costa Pinto 211 -
1
votes1
answer460
viewsA: Double check - Java
You can use the function before doing the Double.parseDouble to check if the String can be converted to Double. boolean isDouble(String str) { try { Double.parseDouble(str); return true; } catch…