本文整理汇总了Java中com.wizzardo.tools.collections.flow.Flow类的典型用法代码示例。如果您正苦于以下问题:Java Flow类的具体用法?Java Flow怎么用?Java Flow使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Flow类属于com.wizzardo.tools.collections.flow包,在下文中一共展示了Flow类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getEntries
import com.wizzardo.tools.collections.flow.Flow; //导入依赖的package包/类
public Collection<TorrentEntry> getEntries(String hash) {
TorrentEntry rootEntry = getRootEntry(hash);
if (rootEntry.getChildren().size() != 1 || Flow.of(rootEntry.getChildren()).all(it -> it.getValue().isFolder()).get()) {
return Collections.singleton(new TorrentEntry(getName(hash), rootEntry.getChildren()));
} else {
return rootEntry.getChildren().values();
}
}
示例2: check
import com.wizzardo.tools.collections.flow.Flow; //导入依赖的package包/类
protected void check() {
rTorrentService.appWebSocketHandler.updateDiskStatus(downloadsDir.getUsableSpace());
List<TorrentInfo> list = rTorrentService.list();
outer:
while (list.size() < torrents.size()) {
for (String hash : torrents.keySet()) {
TorrentInfo torrent = Flow.of(list).filter(it -> it.getHash().equals(hash)).first().get();
if (torrent == null) {
torrent = torrents.remove(hash);
rTorrentService.appWebSocketHandler.onRemove(torrent);
continue outer;
}
}
}
for (TorrentInfo info : list) {
TorrentInfo old = torrents.get(info.getHash());
if (old != null && isUpdated(old, info)) {
rTorrentService.appWebSocketHandler.onUpdate(info);
torrents.put(info.getHash(), info);
} else if (old == null) {
rTorrentService.appWebSocketHandler.onAdd(info);
torrents.put(info.getHash(), info);
}
}
rTorrentService.appWebSocketHandler.checkConnections();
}
示例3: ListResponse
import com.wizzardo.tools.collections.flow.Flow; //导入依赖的package包/类
ListResponse(List<TorrentInfo> infos) {
super("list");
torrents = Flow.of(infos)
.map(AppWebSocketHandler::toSerializedView)
.collect(new ArrayList<>(infos.size()))
.get();
}
示例4: find
import com.wizzardo.tools.collections.flow.Flow; //导入依赖的package包/类
private TorrentInfo find(String torrent) {
return Flow.of(list).filter(ti -> ti.getHash().equals(torrent)).first().get();
}