array Initialize a Typescript Interface with JSON TL;DR: You can initialise a typescript interface using JSON objects. On my quest to load and save objects as JSON, I found that you can convert a JSON object to an interface via something called type assertion. Basically, if you have an interface: export interface PathInterface { path: string enabled:
interface Mock an Observable Interface TL;DR: Use a doAnswer() with a new Answer<Observable<Type>>() if you have to mock observables. Today I wrote my first test where I had to mock an observable interface: public interface UserDatabase { Observable<User> readUser(String username); } where the User model is:
android GoogleApiClient .connect() Interface or Class TL;DR: * If it's your code, check the version play services (com.google.android.gms:play-services-\*). * If you're using a library, check if the library has a version using play services >= 8.1.0. If not, you'll need to clone and upgrade it
expression TIL: Lambda Expressions TL;DR: A lambda expression is a shortcut notation to anonymous inner classes containing a single method. Usually, they define implementations for functional interfaces (interfaces declaring a single method). Today I finally found out what lambda expressions are (formally) by watching this tutorial. Lambda expressions are a concise way of
enum Use a Java Enum with Strings In my project I wanted to log messages using predefined categories. Traditionally, I do it via classes (if the messages are specific to the functions provided by that class): public class LogWrapper { public static final String EVENT_ERROR = "Error"; public static final String EVENT_LOAD = "Load"