/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
import java.time.* ;
import java.time.format.* ;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
{
String input
= "coming from the 11/25/2009 to the 11/30/2009" ; String[] elements
= input.
split( " " ) ; DateTimeFormatter f = DateTimeFormatter.ofPattern( "MM/dd/uuuu" ) ;
List<LocalDate> dates = new ArrayList<>() ;
for( String element
: elements
) { try {
LocalDate ld = LocalDate.parse( element , f ) ;
dates.add( ld ) ;
} catch ( DateTimeParseException e ) {
// Ignore the exception. Move on to next element.
}
}
System.
out.
println( "dates: " + dates
) ;
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgppbXBvcnQgamF2YS50aW1lLiogOwppbXBvcnQgamF2YS50aW1lLmZvcm1hdC4qIDsKCi8qIE5hbWUgb2YgdGhlIGNsYXNzIGhhcyB0byBiZSAiTWFpbiIgb25seSBpZiB0aGUgY2xhc3MgaXMgcHVibGljLiAqLwpjbGFzcyBJZGVvbmUKewoJcHVibGljIHN0YXRpYyB2b2lkIG1haW4gKFN0cmluZ1tdIGFyZ3MpIHRocm93cyBqYXZhLmxhbmcuRXhjZXB0aW9uCgl7ClN0cmluZyBpbnB1dCA9ICJjb21pbmcgZnJvbSB0aGUgMTEvMjUvMjAwOSB0byB0aGUgMTEvMzAvMjAwOSIgOwpTdHJpbmdbXSBlbGVtZW50cyA9IGlucHV0LnNwbGl0KCAiICIgKSA7IApEYXRlVGltZUZvcm1hdHRlciBmID0gRGF0ZVRpbWVGb3JtYXR0ZXIub2ZQYXR0ZXJuKCAiTU0vZGQvdXV1dSIgKSA7Ckxpc3Q8TG9jYWxEYXRlPiBkYXRlcyA9IG5ldyBBcnJheUxpc3Q8PigpIDsKZm9yKCBTdHJpbmcgZ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