// Path: app/src/main/java/com/lucilu/rxdynamicsearch/provider/base/IJsonParserProvider.java
// public interface IJsonParserProvider {
// 
//     /**
//      * Parses from
//      *
//      * @param rawResourceId the id to the raw json file in resources
//      * @param classOfType   the class of the type of the objects in the list
//      * @param <T>           the type of the objects in the list
//      * @return option of the list. Can be {@link Option#NONE} if the parsing fails.
//      */
//     <T> Option<List<T>> parseListFromRawJsonFile(final int rawResourceId,
//                                                  @NonNull final Class<T> classOfType);
// }
// 
// Path: app/src/main/java/com/lucilu/rxdynamicsearch/provider/base/IResourceProvider.java
// public interface IResourceProvider {
// 
//     /**
//      * {@link Resources#openRawResource(int)}
//      */
//     @NonNull
//     InputStream openRawResource(final int id);
// }
// 
// Path: app/src/main/java/com/lucilu/rxdynamicsearch/utils/Preconditions.java
// public final class Preconditions {
// 
//     private Preconditions() {
//         throw new AssertionError("Don't create instances of this object");
//     }
// 
//     /**
//      * Checks if the reference is not null.
//      *
//      * @param reference an object reference
//      * @return the non-null reference
//      * @throws NullPointerException if {@code reference} is null
//      */
//     @NonNull
//     public static <T> T get(@Nullable final T reference) {
//         if (reference == null) {
//             throw new NullPointerException("Assertion for a nonnull object failed.");
//         }
//         return reference;
//     }
// 
//     /**
//      * Checks if the reference is not null.
//      *
//      * @param reference    object reference
//      * @param errorMessage message used if the check fails
//      * @return non-null reference
//      * @throws NullPointerException if {@code reference} is null
//      */
//     public static <T> T checkNotNull(final T reference, @NonNull final String errorMessage) {
//         if (reference == null) {
//             throw new NullPointerException(get(errorMessage));
//         }
//         return reference;
//     }
// 
//     /**
//      * Checks the truth of an expression for an argument.
//      *
//      * @param expression a boolean expression
//      * @param errorMessage message used if the check fails
//      * @throws IllegalArgumentException if {@code expression} is false
//      */
//     public static void checkArgument(boolean expression, @NonNull final String errorMessage) {
//         if (!expression) {
//             throw new IllegalArgumentException(get(errorMessage));
//         }
//     }
// 
//     /**
//      * Asserts that the current thread is a worker thread.
//      */
//     public static void assertWorkerThread() {
//         if (isMainThread()) {
//             throw new IllegalStateException(
//                     "This task must be run on a worker thread and not on the Main thread.");
//         }
//     }
// 
//     /**
//      * Asserts that the current thread is the Main Thread.
//      */
//     public static void assertUiThread() {
//         if (!isMainThread()) {
//             throw new IllegalStateException(
//                     "This task must be run on the Main thread and not on a worker thread.");
//         }
//     }
// 
//     private static boolean isMainThread() {
//         return Objects.equals(Looper.getMainLooper(), Looper.myLooper());
//     }
// }
// 
// Path: app/src/main/java/com/lucilu/rxdynamicsearch/utils/Preconditions.java
// @NonNull
// public static <T> T get(@Nullable final T reference) {
//     if (reference == null) {
//         throw new NullPointerException("Assertion for a nonnull object failed.");
//     }
//     return reference;
// }


import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import com.lucilu.rxdynamicsearch.provider.base.IJsonParserProvider;
import com.lucilu.rxdynamicsearch.provider.base.IResourceProvider;
import com.lucilu.rxdynamicsearch.utils.Preconditions;
import android.support.annotation.NonNull;
import java.io.InputStreamReader;
import java.lang.reflect.Type;
import java.util.List;
import polanski.option.Option;
import timber.log.Timber;
import static com.lucilu.rxdynamicsearch.utils.Preconditions.get;
import static polanski.option.Option.none;
import static polanski.option.Option.ofObj;
package com.lucilu.rxdynamicsearch.provider;







public final class JsonParserProvider implements IJsonParserProvider {

    @NonNull
    private final Gson mGson;

    @NonNull
    private final IResourceProvider mResourceProvider;

    public JsonParserProvider(@NonNull final Gson gson,
// Path: app/src/main/java/com/lucilu/rxdynamicsearch/provider/base/IJsonParserProvider.java
// public interface IJsonParserProvider {
// 
//     /**
//      * Parses from
//      *
//      * @param rawResourceId the id to the raw json file in resources
//      * @param classOfType   the class of the type of the objects in the list
//      * @param <T>           the type of the objects in the list
//      * @return option of the list. Can be {@link Option#NONE} if the parsing fails.
//      */
//     <T> Option<List<T>> parseListFromRawJsonFile(final int rawResourceId,
//                                                  @NonNull final Class<T> classOfType);
// }
// 
// Path: app/src/main/java/com/lucilu/rxdynamicsearch/provider/base/IResourceProvider.java
// public interface IResourceProvider {
// 
//     /**
//      * {@link Resources#openRawResource(int)}
//      */
//     @NonNull
//     InputStream openRawResource(final int id);
// }
// 
// Path: app/src/main/java/com/lucilu/rxdynamicsearch/utils/Preconditions.java
// public final class Preconditions {
// 
//     private Preconditions() {
//         throw new AssertionError("Don't create instances of this object");
//     }
// 
//     /**
//      * Checks if the reference is not null.
//      *
//      * @param reference an object reference
//      * @return the non-null reference
//      * @throws NullPointerException if {@code reference} is null
//      */
//     @NonNull
//     public static <T> T get(@Nullable final T reference) {
//         if (reference == null) {
//             throw new NullPointerException("Assertion for a nonnull object failed.");
//         }
//         return reference;
//     }
// 
//     /**
//      * Checks if the reference is not null.
//      *
//      * @param reference    object reference
//      * @param errorMessage message used if the check fails
//      * @return non-null reference
//      * @throws NullPointerException if {@code reference} is null
//      */
//     public static <T> T checkNotNull(final T reference, @NonNull final String errorMessage) {
//         if (reference == null) {
//             throw new NullPointerException(get(errorMessage));
//         }
//         return reference;
//     }
// 
//     /**
//      * Checks the truth of an expression for an argument.
//      *
//      * @param expression a boolean expression
//      * @param errorMessage message used if the check fails
//      * @throws IllegalArgumentException if {@code expression} is false
//      */
//     public static void checkArgument(boolean expression, @NonNull final String errorMessage) {
//         if (!expression) {
//             throw new IllegalArgumentException(get(errorMessage));
//         }
//     }
// 
//     /**
//      * Asserts that the current thread is a worker thread.
//      */
//     public static void assertWorkerThread() {
//         if (isMainThread()) {
//             throw new IllegalStateException(
//                     "This task must be run on a worker thread and not on the Main thread.");
//         }
//     }
// 
//     /**
//      * Asserts that the current thread is the Main Thread.
//      */
//     public static void assertUiThread() {
//         if (!isMainThread()) {
//             throw new IllegalStateException(
//                     "This task must be run on the Main thread and not on a worker thread.");
//         }
//     }
// 
//     private static boolean isMainThread() {
//         return Objects.equals(Looper.getMainLooper(), Looper.myLooper());
//     }
// }
// 
// Path: app/src/main/java/com/lucilu/rxdynamicsearch/utils/Preconditions.java
// @NonNull
// public static <T> T get(@Nullable final T reference) {
//     if (reference == null) {
//         throw new NullPointerException("Assertion for a nonnull object failed.");
//     }
//     return reference;
// }


// Path: app/src/main/java/com/lucilu/rxdynamicsearch/provider/JsonParserProvider.java
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import com.lucilu.rxdynamicsearch.provider.base.IJsonParserProvider;
import com.lucilu.rxdynamicsearch.provider.base.IResourceProvider;
import com.lucilu.rxdynamicsearch.utils.Preconditions;
import android.support.annotation.NonNull;
import java.io.InputStreamReader;
import java.lang.reflect.Type;
import java.util.List;
import polanski.option.Option;
import timber.log.Timber;
import static com.lucilu.rxdynamicsearch.utils.Preconditions.get;
import static polanski.option.Option.none;
import static polanski.option.Option.ofObj;

package com.lucilu.rxdynamicsearch.provider;







public final class JsonParserProvider implements IJsonParserProvider {

    @NonNull
    private final Gson mGson;

    @NonNull
    private final IResourceProvider mResourceProvider;

    public JsonParserProvider(@NonNull final Gson gson,
                              @NonNull final IResourceProvider resourceProvider) {