javafx.collections.ObservableList.sort()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(1.9k)|赞(0)|评价(0)|浏览(190)

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

ObservableList.sort介绍

暂无

代码示例

代码示例来源:origin: Tristan971/Lyrebird

/**
 * Adds a single tweet to the list of currently loaded ones.
 *
 * @param newTweet The tweet to add.
 */
private boolean addTweet(final Status newTweet) {
  if (!this.loadedTweets.contains(newTweet)) {
    this.loadedTweets.add(newTweet);
    this.loadedTweets.sort(Comparator.comparingLong(Status::getId).reversed());
    if (!isFirstCall.get()) {
      onNewElementStreamed(newTweet);
    }
    return true;
  }
  return false;
}

代码示例来源:origin: Tristan971/Lyrebird

public void addDirectMessage(final DirectMessage directMessageEvent) {
  final long otherId = getOtherId(directMessageEvent);
  final User other = messageEvents.keySet()
                  .stream()
                  .filter(user -> user.getId() == otherId)
                  .findAny()
                  .orElseGet(() -> showUser(otherId));
  final ObservableList<DirectMessage> messagesWithOther = messageEvents.computeIfAbsent(
      other,
      k -> FXCollections.observableArrayList()
  );
  messagesWithOther.add(directMessageEvent);
  messagesWithOther.sort(Comparator.comparingLong(DirectMessage::getId));
}

代码示例来源:origin: com.vektorsoft.demux.desktop/demux-jfx-core

if (deferredItems.containsKey(compId)) {
    ((Menu) item).getItems().addAll(deferredItems.get(compId));
    ((Menu) item).getItems().sort(comparator);
    deferredItems.remove(compId);
    if (parent != null) {
      parent.getItems().add(item);
      parent.getItems().sort(comparator);
    } else {
      addDeferredMenu(item);
    getMenus().add(((Menu) item));
  getMenus().sort(comparator);
});

代码示例来源:origin: com.vektorsoft.demux.desktop/demux-jfx-core

((ToolBar) node).getItems().sort(comparator);
toolbarContainer.getChildren().sort(comparator);
registeredToolbars.put(compId, (ToolBar) node);
if (parent != null) {
  parent.getItems().add(node);
  parent.getItems().sort(comparator);
} else {
  addDeferredNode(parentId, node);

相关文章