public class App {
public static void main( String[] args )
{
ExecutorService executorService = Executors.newCachedThreadPool();
List<String> dateStrList = Lists.newArrayList(
"2018-04-01 10:00:01",
"2018-04-02 11:00:02",
"2018-04-03 12:00:03",
"2018-04-04 13:00:04",
"2018-04-05 14:00:05"
);
final SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
for (final String str : dateStrList) {
executorService.execute(new Runnable() {
public void run() {
// TODO Auto-generated method stub
try {
System.out.println(simpleDateFormat.parse(str));
TimeUnit.SECONDS.sleep(1);
} catch ( Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
}
}
}