- [Data Structures] (https://gist.github.com/lawloretienne/6f7d7d92f72986f5ebd60f226d9044ee#data-structures)
- [Linked Lists] (https://gist.github.com/lawloretienne/6f7d7d92f72986f5ebd60f226d9044ee#linked-lists)
- [Trees] (https://gist.github.com/lawloretienne/6f7d7d92f72986f5ebd60f226d9044ee#trees)
- [Binary Trees] (https://gist.github.com/lawloretienne/6f7d7d92f72986f5ebd60f226d9044ee#binary-trees)
- [Binary Search Tree] (https://gist.github.com/lawloretienne/6f7d7d92f72986f5ebd60f226d9044ee#binary-search-tree)
- [Red-Black Tree] (https://gist.github.com/lawloretienne/6f7d7d92f72986f5ebd60f226d9044ee#red-black-tree)
- [AVL Tree] (https://gist.github.com/lawloretienne/6f7d7d92f72986f5ebd60f226d9044ee#avl-tree)
- [Tries] (https://gist.github.com/lawloretienne/6f7d7d92f72986f5ebd60f226d9044ee#tries)
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
| /* | |
| * The MIT License | |
| * | |
| * Copyright (c) 2016 Andreas Ahlenstorf | |
| * | |
| * Permission is hereby granted, free of charge, to any person obtaining a copy | |
| * of this software and associated documentation files (the "Software"), to deal | |
| * in the Software without restriction, including without limitation the rights | |
| * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| * copies of the Software, and to permit persons to whom the Software is |
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
| /* | |
| * The MIT License | |
| * | |
| * Copyright (c) 2016 Andreas Ahlenstorf | |
| * | |
| * Permission is hereby granted, free of charge, to any person obtaining a copy | |
| * of this software and associated documentation files (the "Software"), to deal | |
| * in the Software without restriction, including without limitation the rights | |
| * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| * copies of the Software, and to permit persons to whom the Software is |
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
| Store<Article> Store = ParsingStoreBuilder.<BufferedSource, String>builder() | |
| .fetcher(this::ResponseAsSource) //responseBody.source() | |
| .persister(SourcePersisterFactory.create(context.getFilesDir()) | |
| .parser(GsonParserFactory.createSourceParser(gson, Article.class)) | |
| .open(); |
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
| Store<Article> ArticleStore = StoreBuilder.<Article>builder() | |
| .fetcher(barCode -> retrofitApi.getArticleObservable(barcode.getValue())) | |
| .open(); |
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
| Store<Article> articleStore = ParsingStoreBuilder.<BufferedSource, Article>builder() | |
| .fetcher(barCode -> api.getSource(barCode.getKey())) | |
| .parser(source -> { | |
| try (InputStreamReader reader = new InputStreamReader(source.inputStream())) { | |
| return gson.fromJson(reader, Article.class); | |
| } catch (IOException e) { | |
| throw new RuntimeException(e);} }) | |
| .open(); |
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
| Store<Article> Store = ParsingStoreBuilder.<BufferedSource, Article>builder() | |
| .fetcher(this::getResponseAsBufferedSource) | |
| .parser(GsonParserFactory.createSourceParser(gson, Article.class)) | |
| .open(); |
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
| Store<Books> bookStore = ParsingStoreBuilder.<BufferedSource, Books>builder() | |
| .fetcher(barCode -> api.getSource(barCode.getKey())) | |
| .persister(SourcePersisterFactory.create(context.getFilesDir()) | |
| .parser(GsonParserFactory.createSourceParser(gson, Books.class)) | |
| .open(); |
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
| void getAllCountries(@NonNull final SelectCountryCallback callback, String username){ | |
| // Attempt to get countries from local cache, if present | |
| if(dbData(callback)) return; | |
| // Call API to get updated list of countries | |
| callToApi(callback,username); | |
| } | |
| void callToApi(callback,username); | |
| { |
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
| ApolloWatcher<EpisodeHeroName.Data> watcher = apolloClient.newCall(query).watcher(); | |
| RxApollo | |
| .toObservable(watcher) | |
| .subscribe(new Observer<EpisodeHeroName.Data>() { | |
| @Override public void onCompleted() { | |
| } | |
| @Override public void onError(Throwable e) { |