java.util.stream.Collectors.toUnmodifiableList()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(3.0k)|赞(0)|评价(0)|浏览(284)

本文整理了Java中java.util.stream.Collectors.toUnmodifiableList()方法的一些代码示例,展示了Collectors.toUnmodifiableList()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Collectors.toUnmodifiableList()方法的具体详情如下:
包路径:java.util.stream.Collectors
类名称:Collectors
方法名:toUnmodifiableList

Collectors.toUnmodifiableList介绍

暂无

代码示例

代码示例来源:origin: com.github.tornaia/aott-desktop-client-core

  1. public ProcessTreeTableModel(CategoryService categoryService, DashboardEventPublisher dashboardEventPublisher) {
  2. super(new DefaultMutableTreeTableNode());
  3. this.categoryService = categoryService;
  4. this.dashboardEventPublisher = dashboardEventPublisher;
  5. this.fixColumns = Arrays.stream(ProcessTreeTableColumn.values())
  6. .map(ProcessTreeTableColumn::getVisibleName)
  7. .collect(Collectors.toUnmodifiableList());
  8. this.processList = new ArrayList<>();
  9. }

代码示例来源:origin: com.github.tornaia/aott-desktop-client-core

  1. @Override
  2. public List<AbstractUserEvent> read() {
  3. synchronized (userEvents) {
  4. if (userEvents.isEmpty()) {
  5. Path logsDirectory = sessionSettingsProvider.getLogsDirectory();
  6. Path userEventsFile = logsDirectory.resolve("user.events.log");
  7. try (Stream<String> lines = Files.lines(userEventsFile)) {
  8. userEvents.addAll(lines
  9. .map(this::convertLineToAbstractUserEvent)
  10. .map(AbstractUserEvent.class::cast)
  11. .sorted(Comparator.comparingLong(AbstractEvent::getTimestamp))
  12. .collect(Collectors.toUnmodifiableList()));
  13. } catch (IOException e) {
  14. throw new RuntimeException("Must not happen", e);
  15. }
  16. }
  17. }
  18. return userEvents;
  19. }

代码示例来源:origin: net.dongliu/xhttp

  1. private List<Cookie> parseCookies() {
  2. var cookieValues = getHeaders(HeaderNames.SET_COOKIE);
  3. // hope timestamp do not diff too much
  4. var createTime = Instant.now();
  5. return cookieValues.stream()
  6. .flatMap(v -> HttpCookie.parse(v).stream())
  7. .map(c -> Cookies.ofHttpCookie(createTime, c))
  8. .collect(toUnmodifiableList());
  9. }

代码示例来源:origin: com.github.tornaia/aott-desktop-client-core

  1. @Override
  2. public List<CategoryState> getCategoryState(String process, List<String> groupTitle) {
  3. String category = getCategory(process, groupTitle);
  4. return getCategories()
  5. .stream()
  6. .map(c -> new CategoryState(c, c.equals(category)))
  7. .collect(Collectors.toUnmodifiableList());
  8. }

代码示例来源:origin: com.yahoo.vespa/controller-api

  1. @Override
  2. public List<Record> findRecords(Record.Type type, RecordData data) {
  3. return records.values().stream()
  4. .filter(record -> record.type() == type && record.data().equals(data))
  5. .collect(Collectors.toUnmodifiableList());
  6. }

代码示例来源:origin: com.github.tornaia/aott-desktop-client-core

  1. @Override
  2. public List<CategoryState> getCategoryState(String process) {
  3. String category = getCategory(process);
  4. return getCategories()
  5. .stream()
  6. .map(c -> new CategoryState(c, c.equals(category)))
  7. .collect(Collectors.toUnmodifiableList());
  8. }

代码示例来源:origin: com.yahoo.vespa/controller-api

  1. @Override
  2. public List<Record> findRecords(Record.Type type, RecordName name) {
  3. return records.values().stream()
  4. .filter(record -> record.type() == type && record.name().equals(name))
  5. .collect(Collectors.toUnmodifiableList());
  6. }

相关文章