Nizzle94
01/23/2018, 2:21 AMhmole
01/23/2018, 7:53 AMScott
01/23/2018, 7:54 AMPaul Woitaschek
01/23/2018, 9:37 AM@Parcelize
?nickk
01/23/2018, 11:28 AM@Suppress
. Is there a list somewhere?jw
01/23/2018, 5:18 PMkirillrakhman
01/24/2018, 9:12 AMWarning:Configuration 'compile' is obsolete and has been replaced with 'implementation'. It will be removed at the end of 2018I don't have any
compile
dependencies anymore. Could it be the Kotlin plugin that causes the warning?Ayden
01/24/2018, 2:48 PMeyal
01/24/2018, 3:27 PMtgmcians
01/24/2018, 6:40 PMthis class implements parcelable but does not provide a creator field
temp_man
01/24/2018, 11:23 PMNizzle94
01/25/2018, 8:22 AMmagicleon
01/25/2018, 6:45 PMyasir-ameen
01/27/2018, 7:07 AMJoe
01/27/2018, 1:30 PMinterface Logger : AnkoLogger
zkeme
01/27/2018, 3:45 PMLoránd
01/28/2018, 3:16 PMkenkyee
01/28/2018, 5:52 PMnoone
01/28/2018, 7:38 PModay
01/29/2018, 10:19 AMAditya
01/29/2018, 12:47 PMjw
01/30/2018, 12:00 AMjw
01/30/2018, 12:04 AMRick
01/30/2018, 4:39 AMaeruhxi
01/30/2018, 6:29 AMAditya
01/30/2018, 7:56 AMAditya
01/30/2018, 10:13 PMAyden
01/31/2018, 9:38 AMAyden
01/31/2018, 9:43 AMclass MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemSelectedListener {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
loadFragment(new HomeFragment())
BottomNavigationView navigation = findViewById(R.id.navigation)
navigation.setOnNavigationItemSelectedListener(this)
}
...
fun onNavigationItemSelected(item: MenuItem?): Boolean {
fragment: Fragment = null
return true
}
}
Kevin Janvier Chinabalire
01/31/2018, 10:08 AMvar model:User()
forEachIndexed { index, users ->{
println("my $users ")
}
println("I want to access my result outside for loop")
Kevin Janvier Chinabalire
01/31/2018, 10:08 AMvar model:User()
forEachIndexed { index, users ->{
println("my $users ")
}
println("I want to access my result outside for loop")
edwardwongtl
01/31/2018, 10:20 AMKevin Janvier Chinabalire
01/31/2018, 10:22 AMprintln("Result $model")
... Not an arraylistedwardwongtl
01/31/2018, 10:24 AMKevin Janvier Chinabalire
01/31/2018, 10:24 AMval arraylist = ArrayList<User>()
val arraylist = ArrayList<User>()
var model:User()
forEachIndexed { index, users ->{
println("my $users ")
}
println("Result $model")
edwardwongtl
01/31/2018, 10:27 AMarraylist.forEachIndexed
?Kevin Janvier Chinabalire
01/31/2018, 10:28 AMedwardwongtl
01/31/2018, 10:28 AMArrayList<User>
, then you can use filter{}
to get the matches, or even first {}
if you just need one resultKevin Janvier Chinabalire
01/31/2018, 10:28 AMarraylist.forEachIndexed
val arraylist = ArrayList<User>()
var model:User()
arraylist.forEachIndexed { index, users ->{
println("my $users ")
}
println("Result $model")
where i need help is to access that model ... which is not an arraylist model just a model like aboveedwardwongtl
01/31/2018, 10:31 AMvar model
to the first one that matches some condition inside the val arraylist
?Kevin Janvier Chinabalire
01/31/2018, 10:33 AMvar model
which i declare up ...model
it cannot be an array
edwardwongtl
01/31/2018, 10:35 AMfun
inside the loop?Kevin Janvier Chinabalire
01/31/2018, 10:37 AMedwardwongtl
01/31/2018, 10:39 AMfun
for every User
in the list, then use filter
to get rid of the unwanted User
first, then map
each User
to the result of that fun
Kevin Janvier Chinabalire
01/31/2018, 10:56 AMfun
inside a for
cz filtering is not helpingvar getuser:List<User> = arralist.filter { user -> User ==User() }
println("FILTER 909 $getuser")
getuser.map { dataModel ->
log("DADADADADDAAD $dataModel")
}
edwardwongtl
01/31/2018, 11:00 AMfun action(user: User): T = ...
val arraylist: ArrayList<User>
arraylist.filter { user -> user == ... }.map { action(it) }
If action()
does not return a value, replace the .map
with .forEach
Kevin Janvier Chinabalire
01/31/2018, 11:05 AMarraylist.filter { user -> user == User() }.map
edwardwongtl
01/31/2018, 11:06 AM.map { User() }
Kevin Janvier Chinabalire
01/31/2018, 11:09 AMedwardwongtl
01/31/2018, 11:10 AMuser == User()
filter
is not meant for manipulating dataKevin Janvier Chinabalire
01/31/2018, 11:15 AMedwardwongtl
01/31/2018, 11:19 AMArrayList<User>
, and you want to pass some of them into a function fun action(user: User): Result
, and gather all the results.
Am I getting it wrong, or you want to actually manipulate the ArrayList<User>
?Kevin Janvier Chinabalire
01/31/2018, 12:04 PMArrayList<User>
i want to access the model by loopingedwardwongtl
01/31/2018, 12:13 PMusers.filter { boolean condition }.map { user -> getResult(user) }
This will gives you back List<Result>
which you can then operate on