This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Existing interfaces that are now considered functional interfaces: | |
| interface java.lang.Runnable { | |
| void run(); | |
| } | |
| interface java.util.concurrent.Executor { | |
| void execute(java.lang.Runnable command); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public interface Collection<E> extends Iterable<E> { | |
| // Traditional, abstract methods: | |
| int size(); | |
| boolean contains(Object o); | |
| boolean add(E e); | |
| boolean remove(Object o); | |
| // Etc... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public interface Person { | |
| public abstract String getFirstName(); | |
| public abstract String getLastName(); | |
| public default String getDisplayableFullName() { | |
| return getLastName() + ", " + getFirstName(); | |
| } | |
| public abstract boolean isStudent(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Person | |
| { | |
| private string name; | |
| public Person(string name) | |
| { | |
| this.name = name; | |
| } | |
| public string Name { get { return this.name; } } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| List<string> ss = new List<string>(); | |
| ss.Add("Hello"); | |
| ss.Add("World"); | |
| var helloLength1 = from s in ss | |
| where s.StartsWith("H") | |
| select s.Length; | |
| var helloLength2 = ss.Where(s => s.StartsWith("H")).Select(s => s.Length); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Delegate | |
| { | |
| delegate int BinOp(int x, int y); | |
| BinOp Plus() | |
| { | |
| return (x, y) => x + y; | |
| } | |
| int Calculate(int x, int y) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var xs = Observable.Range(1, 10) | |
| .Select(x => x + 1) | |
| .Where(x => x % 3 == 0); | |
| xs.ObserveOn(Scheduler.Default).Subscribe( | |
| el => Console.WriteLine("Got element: {0}", el), | |
| ex => Console.WriteLine("Error: {0}", ex.Message), | |
| () => Console.WriteLine("Completed.") | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static DictServiceSoapClient client = new DictServiceSoapClient("DictServiceSoapClient"); | |
| static TextBox txt = new TextBox(); | |
| static Form form = new Form() { Controls = { txt } }; | |
| static void Work() | |
| { | |
| var input = Observable.FromEventPattern(txt, "TextChanged") | |
| .Throttle(TimeSpan.FromMilliseconds(200)) | |
| .Select(x => ((TextBox)x.Sender).Text) |
NewerOlder