All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jedi.example.OptionExample Maven / Gradle / Ivy

There is a newer version: 3.0.5
Show newest version
package jedi.example;

import jedi.option.Option;
import jedi.option.OptionMatcher;

import static jedi.option.Options.some;

public class OptionExample {

	public static void main(String[] args) {
		Option x = some("foo");

        // Matching using a visitor
		x.match(new OptionMatcher() {
			public void caseNone() {
				System.out.println("oops, shouldn't be here");
			}

			public void caseSome(String value) {
				System.out.println("matched " + value);
			}
		});

        // match with for if you're only interested in Some
        for (String v : x) System.out.println("Got " + v);
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy