本文整理了Java中java.util.stream.Collectors.toUnmodifiableList()
方法的一些代码示例,展示了Collectors.toUnmodifiableList()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Collectors.toUnmodifiableList()
方法的具体详情如下:
包路径:java.util.stream.Collectors
类名称:Collectors
方法名:toUnmodifiableList
暂无
代码示例来源:origin: com.github.tornaia/aott-desktop-client-core
public ProcessTreeTableModel(CategoryService categoryService, DashboardEventPublisher dashboardEventPublisher) {
super(new DefaultMutableTreeTableNode());
this.categoryService = categoryService;
this.dashboardEventPublisher = dashboardEventPublisher;
this.fixColumns = Arrays.stream(ProcessTreeTableColumn.values())
.map(ProcessTreeTableColumn::getVisibleName)
.collect(Collectors.toUnmodifiableList());
this.processList = new ArrayList<>();
}
代码示例来源:origin: com.github.tornaia/aott-desktop-client-core
@Override
public List<AbstractUserEvent> read() {
synchronized (userEvents) {
if (userEvents.isEmpty()) {
Path logsDirectory = sessionSettingsProvider.getLogsDirectory();
Path userEventsFile = logsDirectory.resolve("user.events.log");
try (Stream<String> lines = Files.lines(userEventsFile)) {
userEvents.addAll(lines
.map(this::convertLineToAbstractUserEvent)
.map(AbstractUserEvent.class::cast)
.sorted(Comparator.comparingLong(AbstractEvent::getTimestamp))
.collect(Collectors.toUnmodifiableList()));
} catch (IOException e) {
throw new RuntimeException("Must not happen", e);
}
}
}
return userEvents;
}
代码示例来源:origin: net.dongliu/xhttp
private List<Cookie> parseCookies() {
var cookieValues = getHeaders(HeaderNames.SET_COOKIE);
// hope timestamp do not diff too much
var createTime = Instant.now();
return cookieValues.stream()
.flatMap(v -> HttpCookie.parse(v).stream())
.map(c -> Cookies.ofHttpCookie(createTime, c))
.collect(toUnmodifiableList());
}
代码示例来源:origin: com.github.tornaia/aott-desktop-client-core
@Override
public List<CategoryState> getCategoryState(String process, List<String> groupTitle) {
String category = getCategory(process, groupTitle);
return getCategories()
.stream()
.map(c -> new CategoryState(c, c.equals(category)))
.collect(Collectors.toUnmodifiableList());
}
代码示例来源:origin: com.yahoo.vespa/controller-api
@Override
public List<Record> findRecords(Record.Type type, RecordData data) {
return records.values().stream()
.filter(record -> record.type() == type && record.data().equals(data))
.collect(Collectors.toUnmodifiableList());
}
代码示例来源:origin: com.github.tornaia/aott-desktop-client-core
@Override
public List<CategoryState> getCategoryState(String process) {
String category = getCategory(process);
return getCategories()
.stream()
.map(c -> new CategoryState(c, c.equals(category)))
.collect(Collectors.toUnmodifiableList());
}
代码示例来源:origin: com.yahoo.vespa/controller-api
@Override
public List<Record> findRecords(Record.Type type, RecordName name) {
return records.values().stream()
.filter(record -> record.type() == type && record.name().equals(name))
.collect(Collectors.toUnmodifiableList());
}
内容来源于网络,如有侵权,请联系作者删除!