void () { Keymap grandChild = myChild.deriveKeymap("GrandChild"); Runnable task = () -> { for (int i = 0; i < 1000; i++) { assertEquals(Shortcut.EMPTY_ARRAY, grandChild.getShortcuts("none")); List<Shortcut> shortcuts = Arrays.asList(grandChild.getShortcuts(ACTION_1)); assertTrue(shortcuts.size() >= 2 && shortcuts.size() <= 3); String message = shortcuts.toString(); assertTrue(message, shortcuts.contains(shortcut1)); assertTrue(message, shortcuts.contains(shortcutA)); if (shortcuts.size() == 3) { assertTrue(message, shortcuts.contains(shortcut2)); } } }; List<CompletableFuture<Void>> tasks = StreamEx.constant(task, 10).map(CompletableFuture::runAsync).toList(); for (int i = 0; i < 10000; i++) { grandChild.addShortcut(ACTION_1, shortcut2); grandChild.removeShortcut(ACTION_1, shortcut2); } tasks.forEach(CompletableFuture::join); }