[Solved] Suggest data-structure for this use case [closed]
[ad_1] Since you want the thread to wait for an answer, I’d suggest creating a question object that has the question text, can store the answer, and has a CountDownLatch for tracking when the answer is available. public final class Question { private final String question; private String answer; private CountDownLatch latch = new CountDownLatch(1); … Read more