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
| @Module(subcomponents = ActivityModule_ContributesMainActivity.MainActivitySubcomponent.class) | |
| public abstract class ActivityModule_ContributesMainActivity { | |
| private ActivityModule_ContributesMainActivity() {} | |
| @Binds | |
| @IntoMap | |
| @ActivityKey(MainActivity.class) | |
| abstract AndroidInjector.Factory<? extends Activity> bindAndroidInjectorFactory( | |
| MainActivitySubcomponent.Builder builder); |
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
| private void initialize(final Builder builder) { | |
| this.mainActivitySubcomponentBuilderProvider = | |
| new Provider<ActivityModule_ContributesMainActivity.MainActivitySubcomponent.Builder>() { | |
| @Override | |
| public ActivityModule_ContributesMainActivity.MainActivitySubcomponent.Builder get() { | |
| return new MainActivitySubcomponentBuilder(); | |
| } | |
| }; | |
| ... | |
| } |
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 BaseApplication: Application(), HasActivityInjector { | |
| @Inject | |
| lateinit var dispatchingAndroidInjector: DispatchingAndroidInjector<Activity> | |
| override fun onCreate() { | |
| super.onCreate() | |
| ApplicationInjector.init(this) | |
| } | |
| override fun activityInjector() = dispatchingAndroidInjector |
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
| object ApplicationInjector { | |
| fun init(app: BaseApplication) { | |
| DaggerApplicationComponent.builder().application(app) | |
| .build().inject(app) | |
| } |
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
| @Singleton | |
| @Component(modules = [ | |
| AndroidInjectionModule::class, | |
| ApplicationModule::class, | |
| ActivityModule::class] | |
| ) | |
| interface ApplicationComponent { | |
| @Component.Builder | |
| interface Builder { | |
| @BindsInstance |
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
| fun getPetsWithCoroutines() { | |
| GlobalScope.launch { | |
| val response: Response<JsonResponse> = petManager.getPetList("78701").execute() | |
| response?.body()?.petFinder?.pets?.pet?.let { | |
| petList.addAll(it) | |
| } | |
| } | |
| } |
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
| private class PetTask(val petList: ArrayList<Pet>, val petManager: PetManager): AsyncTask<Void, Void, Response<JsonResponse>>() { | |
| override fun doInBackground(vararg params: Void?): Response<JsonResponse> { | |
| return petManager.getPetList("78701").execute() | |
| } | |
| override fun onPostExecute(result: Response<JsonResponse>?) { | |
| result?.body()?.petFinder?.pets?.pet?.let { | |
| petList.addAll(it) | |
| } | |
| } |
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
| // bottom up (tabulation) | |
| static int fibBottomUp(int n){ | |
| int[] fib = new int[n + 1]; | |
| fib[0] = 1; | |
| fib[1] = 1; | |
| for(int i = 2; i <= n; i++){ | |
| fib[i] = fib[i - 2] + fib[i - 1]; | |
| } |
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
| // Given an array of objects with a value and weight, figure out the combo to fit in your knapsack with the highest value | |
| // There is an unlimited ammount of each object | |
| public class Solution{ | |
| public class Item{ | |
| int value; | |
| int weight; | |
| public Item(int value, int weight){ | |
| this.value = value; | |
| this.weight = weight; |
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 excelbuilder = require('msexcel-builder'); | |
| var quote = { | |
| Name: 'TEST', | |
| Account__c: '001m000000VrHEu', | |
| Opportunity__c: '006m0000005awRR' | |
| }; | |
| var quoteProducts = [{ | |
| Name: 'TEST1', |
NewerOlder