mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-11-17 03:07:12 +00:00
Refactor various components
This commit is contained in:
1 parent
b54d8ad362
commit
d63882c5ff
45 files changed
+771
-190
No files matched your search
@@ -0,0 +1,30 @@
|
||||
package io.xpipe.sample;
|
||||
|
||||
import io.xpipe.api.DataSource;
|
||||
import io.xpipe.api.DataTable;
|
||||
import io.xpipe.core.data.node.TupleNode;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
public class HomePricesSample {
|
||||
|
||||
private static DataTable homePricesTable;
|
||||
|
||||
public static void main(String[] args) {
|
||||
var resource = HomePricesSample.class.getResource("homes.csv");
|
||||
|
||||
// Creates a wrapped data source using the url.
|
||||
// Note that while this is possible, it is not recommended as
|
||||
// all queries are routed through the XPipe client anyway.
|
||||
// It allows us however to bundle the data with this sample program.
|
||||
homePricesTable = DataSource.wrap(resource).asTable();
|
||||
|
||||
System.out.println("The highest selling house entry is: " + getHighestSellingHouse());
|
||||
}
|
||||
|
||||
private static TupleNode getHighestSellingHouse() {
|
||||
return homePricesTable.stream()
|
||||
.min(Comparator.comparingInt(t -> t.forKey("Sell").asInt()))
|
||||
.get();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
module io.xpipe.sample {
|
||||
requires io.xpipe.api;
|
||||
}
|
||||
Reference in new issue
Block a user