Double Java 流在需要时不离开

Double Java Stream not leaving when wanted

这是我的问题。

public LinkedHashSet<Quiz> findAllQuizByCompanyAndCategory(List<QuizCompany> quizList, String quizCategoryId) {
    int i = 1;
    return hibernateQuizJpaRepository
                 .findAllByCategorySetContaining(new HibernateQuizCategory(quizCategoryId))
                 .stream()
                 .filter(current -> quizList.stream()
                 .anyMatch(quiz -> Objects.equals(current.getId(), quiz.getQuizId())))
                 .map(HibernateQuiz::toQuiz)
                 .collect(Collectors.toCollection(LinkedHashSet::new));
 }

正如您在屏幕上看到的,quizId 和 id 在任意匹配中是相同的。 但它永远不会进入地图。有人知道为什么吗?

已删除断点,因为问题已解决

尝试在

上使用String.intern
    current.getId().intern() 

  quiz.getQuizId().intern()