@@ -0,0 +1,1733 @@
+package com.spotify.featran.java.examples;%0A%0Aimport com.spotify.featran.java.JFeatureExtractor;%0Aimport com.spotify.featran.java.JFeatureSpec;%0Aimport com.spotify.featran.transformers.MinMaxScaler;%0Aimport com.spotify.featran.transformers.OneHotEncoder;%0A%0Aimport java.util.*;%0A%0Apublic class JavaExample %7B%0A%0A  private static class Record %7B%0A    private final double d;%0A    private final Optional%3CString%3E s;%0A%0A    Record(double d, Optional%3CString%3E s) %7B%0A      this.d = d;%0A      this.s = s;%0A    %7D%0A  %7D%0A%0A  private static final Random rand = new Random();%0A%0A  private static List%3CRecord%3E randomRecords() %7B%0A    List%3CRecord%3E records = new ArrayList%3C%3E();%0A    for (int i = 0; i %3C 20; i++) %7B%0A      Optional%3CString%3E s = i %25 5 == 0 ? Optional.empty() : Optional.of(%22s%22 + rand.nextInt(5));%0A      records.add(new Record(rand.nextDouble(), s));%0A    %7D%0A    return records;%0A  %7D%0A%0A  public static void main(String%5B%5D args) %7B%0A    // Random input%0A    List%3CRecord%3E records = randomRecords();%0A%0A    // Start building a feature specification%0A    JFeatureSpec%3CRecord%3E fs = JFeatureSpec.%3CRecord%3Eof()%0A        .required(r -%3E r.d, MinMaxScaler.apply(%22min-max%22, 0.0, 1.0))%0A        .optional(r -%3E r.s, OneHotEncoder.apply(%22one-hot%22));%0A%0A    // Extract features from List%3CRecord%3E%0A    JFeatureExtractor%3CRecord%3E f1 = fs.extract(records);%0A%0A    System.out.println(f1.featureNames());%0A%0A    // Get feature values as double%5B%5D%0A    for (double%5B%5D f : f1.featureValuesDouble()) %7B%0A      System.out.println(Arrays.toString(f));%0A    %7D%0A%0A    // Extract settings as a JSON string%0A    String settings = f1.featureSettings();%0A    System.out.println(settings);%0A%0A    // Extract features from new records ,but reuse previously saved settings%0A    fs.extractWithSettings(randomRecords(), settings);%0A  %7D%0A%7D%0A

add JavaExample