/** * Convert this object to a SimpleOrderedMap, making it easier to serialize. * * @return the equivalent SimpleOrderedMap for this object. */ public SimpleOrderedMap<Object> toMap() { SimpleOrderedMap<Object> map = new SimpleOrderedMap<>(); if (label != null) { map.add(LABEL_KEY, label); } map.add(VALUE_KEY, value); map.add(COUNT_KEY, count); map.add(TOTAL_KEY, getTotal()); if (hierarchy != null && hierarchy.size() > 0) { // Recurse through the child nodes, converting each to a map List<NamedList<Object>> hierarchyList = hierarchy.stream().map(TreeFacetField::toMap).collect(Collectors.toList()); map.add(HIERARCHY_KEY, hierarchyList); } return map; }
private void updatePopup() { if (getText() == null) { return; } LinkedList<String> searchResult = new LinkedList<>(); searchResult.addAll( entries.stream().filter(x -> x.startsWith(getText())).collect(Collectors.toList())); if (entries.size() > 0) { populatePopup(searchResult); if (!popup.isShowing()) { Point2D p = this.localToScene(0.0, 0.0); double x = p.getX() + this.getScene().getX() + this.getScene().getWindow().getX(); double y = p.getY() + this.getScene().getY() + this.getScene().getWindow().getY() + this.getHeight(); popup.show(AutoCompleteTextField.this, x, y); } } else { popup.hide(); } }
private SortedSet<Song> songsSince(SortedSet<Song> songs, long since) { return songs .stream() .filter(song -> song.getTimestamp() >= since) .collect(toCollection(TreeSet::new)); }