- Aug 07 Mon 2023 23:58
[福岡] 福岡機場免稅店介紹
- Jul 13 Thu 2023 00:00
[Java] 合併多個相同物件內的List物件 ( use flatmap java 8
合併多個相同物件內的List物件 物件設定
@Data public class TestTOB { private List type; public static class Sel { private String key; private String val; /** * @param a * @param b */ public Sel(String key, String val) { super(); this.key = key; this.val = val; } @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("Sel [key=").append(key).append(", val=").append(val).append("]"); return builder.toString(); } } }
用flatMap將TestTOB內的List轉換成個別扁平流,再透過collect結合
@Test public void flatMapTest() throws Exception { List a= new ArrayList<>(); TestTOB qq = new TestTOB(); qq.setType(Collections.singletonList(new TestTOB.Sel("a","1"))); a.add(qq); qq = new TestTOB(); qq.setType(Collections.singletonList(new TestTOB.Sel("b","2"))); a.add(qq); qq = new TestTOB(); qq.setType(Collections.singletonList(new TestTOB.Sel("c","3"))); a.add(qq); List c = a.stream() .flatMap(o -> o.getType().stream()) .collect(Collectors.toList()); c.stream().forEach(o->System.out.println(o.toString())); } //Sel [key=a, val=1] //Sel [key=b, val=2] //Sel [key=c, val=3]
- Jul 12 Wed 2023 00:00
[JAVA] ThreadPoolTaskScheduler.schedule 非預期執行時間
使用ThreadPoolTaskScheduler.schedule會因為任務執行的時間超過觸發器間隔,而延後後序排程時間。
以下程式RUN出來會發現
public String scheduleTask() { Runnable task = () -> { System.out.println(Thread.currentThread().getName() + "-Scheduled task started at: " + new Date()); try { Thread.sleep(10000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println(Thread.currentThread().getName() + "-Scheduled task resumed at: " + new Date()); }; taskScheduler.schedule(task, new CronTrigger("0/5 * * * * *")); return "Schedule task triggered successfully!"; } // Task-Scheduled-1-Scheduled task started at: Wed Jul 12 15:30:10 CST 2023 // Task-Scheduled-1-Scheduled task resumed at: Wed Jul 12 15:30:20 CST 2023 // Task-Scheduled-2-Scheduled task started at: Wed Jul 12 15:30:25 CST 2023 // Task-Scheduled-2-Scheduled task resumed at: Wed Jul 12 15:30:35 CST 2023 // Task-Scheduled-1-Scheduled task started at: Wed Jul 12 15:30:40 CST 2023 // Task-Scheduled-1-Scheduled task resumed at: Wed Jul 12 15:30:50 CST 2023
如果不希望等待前一個排程作業結束,希望時間到就執行可以加入CompletableFuture.runAsync
public String scheduleTask2() { Runnable task = () -> { CompletableFuture.runAsync(() -> { System.out.println(Thread.currentThread().getName() + "-Scheduled task started at: " + new Date()); try { Thread.sleep(10000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println(Thread.currentThread().getName() + "-Scheduled task resumed at: " + new Date()); }); }; taskScheduler.schedule(task, new CronTrigger("0/5 * * * * *")); // ForkJoinPool.commonPool-worker-1-Scheduled task started at: Wed Jul 12 15:33:15 CST 2023 // ForkJoinPool.commonPool-worker-2-Scheduled task started at: Wed Jul 12 15:33:20 CST 2023 // ForkJoinPool.commonPool-worker-3-Scheduled task started at: Wed Jul 12 15:33:25 CST 2023 // ForkJoinPool.commonPool-worker-1-Scheduled task resumed at: Wed Jul 12 15:33:25 CST 2023 // ForkJoinPool.commonPool-worker-1-Scheduled task started at: Wed Jul 12 15:33:30 CST 2023 // ForkJoinPool.commonPool-worker-2-Scheduled task resumed at: Wed Jul 12 15:33:30 CST 2023 // ForkJoinPool.commonPool-worker-2-Scheduled task started at: Wed Jul 12 15:33:35 CST 2023 // ForkJoinPool.commonPool-worker-3-Scheduled task resumed at: Wed Jul 12 15:33:35 CST 2023 return "Schedule task triggered successfully!"; }
- Jun 17 Sat 2023 00:00
[java spring boot] 來安裝監控功能SpringBoot Admin
- Mar 28 Tue 2023 00:00
[航空-星宇] 退換票相關
在二月的時候買了星宇航空要去東京賞櫻,結果櫻花提前開,只好退票重買機票,就剛好親身走了一次很不友善的星宇航空票務逆流程。
最不友善的在於,客服非常非常非常難聯絡,比銀行信用卡還難連絡,還好到最後還是順利退了又定完新機票。以下分享給大家退改票可能會遇到的一些問題(更新時間2023/3/28)。
客服連絡方式
官方聯絡資訊:- Jan 15 Sun 2023 14:31
[日本] Visit Japan Web(入境資料電子申請) 申請流程教學
目前日本為了流暢入境日本的程序,將入境資料電子化,提供入境日本的人申請Visit Japan Web,內容包含「入境審查」、「海關申報」、「檢疫(快速通關)」的資料。
✅ Visit Japan Web官網:https://www.vjw.digital.go.jp/
- Jan 12 Thu 2023 02:10
[福岡] 2023更新-天神、博多到太宰府交通方式
博多車站 ↔ 太宰府
巴士:
太宰府ライナーバス「旅人」( 太宰府定期巴士「旅人」 )
https://www.nishitetsu.jp/zh_tw/bus/dazaihu_liner.html (中)
從博多巴士總站( 博多バスターミナル )到太宰府的快速巴士,會行經福岡機場。
車子外觀很特別,有不同主題的彩繪圖案,班次也多:平日有19班、週六、週日和假日有23班。
車子外觀很特別,有不同主題的彩繪圖案,班次也多:平日有19班、週六、週日和假日有23班。
❎不可預約