1 /* 2 * Copyright (C) 2015 The Dagger Authors. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package dagger.functional; 18 19 import dagger.Module; 20 import dagger.Provides; 21 import java.util.ArrayList; 22 import java.util.HashSet; 23 import java.util.LinkedList; 24 import java.util.List; 25 import java.util.Set; 26 27 @Module 28 class BoundedGenericModule { 29 30 @Provides provideInteger()31 Integer provideInteger() { 32 return 1; 33 } 34 35 @Provides provideDouble()36 Double provideDouble() { 37 return 2d; 38 } 39 40 @Provides provideArrayListString()41 ArrayList<String> provideArrayListString() { 42 ArrayList<String> list = new ArrayList<>(); 43 list.add("arrayListOfString"); 44 return list; 45 } 46 47 @Provides provideLinkedListString()48 LinkedList<String> provideLinkedListString() { 49 LinkedList<String> list = new LinkedList<>(); 50 list.add("linkedListOfString"); 51 return list; 52 } 53 54 @Provides provideLinkedListCharSeq()55 LinkedList<CharSequence> provideLinkedListCharSeq() { 56 LinkedList<CharSequence> list = new LinkedList<>(); 57 list.add("linkedListOfCharSeq"); 58 return list; 59 } 60 61 @Provides 62 @SuppressWarnings("unchecked") provideArrayListOfComparableString()63 LinkedList<Comparable<String>> provideArrayListOfComparableString() { 64 LinkedList<Comparable<String>> list = new LinkedList<>(); 65 list.add("arrayListOfComparableOfString"); 66 return list; 67 } 68 69 @Provides provideListOfInteger()70 List<Integer> provideListOfInteger() { 71 LinkedList<Integer> list = new LinkedList<>(); 72 list.add(3); 73 return list; 74 } 75 76 @Provides provideSetOfDouble()77 Set<Double> provideSetOfDouble() { 78 Set<Double> set = new HashSet<>(); 79 set.add(4d); 80 return set; 81 } 82 } 83