This week's book giveaway is in the Web Services forum.
We're giving away four copies of Microservices in Action and have Morgan Bruce & Paulo A. Pereira on-line!
See this thread for details.
Win a copy of Microservices in Action this week in the Web Services forum!

Giovanni Montano

Ranch Hand
+ Follow
since Apr 29, 2014
Giovanni likes ...
Android Open BSD Slackware
Based in the Netherlands, I am Italian, this is not my real name, but similar.
Like Running, Bach, Plato, History, Football, Green tea, Statistics.

Android/Java/Python/Machine Learning
at the moment as an hobby
Cows and Likes
Cows
Total received
10
In last 30 days
0
Total given
0
Likes
Total received
39
Received in last 30 days
0
Total given
73
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Giovanni Montano

Campbell Ritchie wrote:Not sure I understand the exact problem, but have you come across Stream.collect(Collectors.partitioningBy()?


Campbell Ritchie wrote:Not sure I understand the exact problem, but have you come across Stream.collect(Collectors.partitioningBy()?


Thank you very much.

The internals of the method are quite simple:

public static <T> Collector<T, ?, Map<Boolean, List<T>>> partitioningBy(Predicate<? super T> predicate) {
       return partitioningBy(predicate, toList());


(I mean as it is a beginner forum, for the readers that know of course concepts as  parametrization with generics, Map, Covariance, and functional paradigms)

The problem is that
1) I cannot use java 8 Streams in android, and also I do everything in Kotlin, but this is not a problem because I am speaking about business logic and I could use RXJava that has houndreads of operators to transform Observables, much more than streams
so the real problem is number 2:
2) I am just doing an intellectual exercise, so I want to know the algorithm behind, and not a method, and not partitioningBy unfortunately does not resolve my case, because you need to pass a logic to sort the variablesW
let's say as use case, I have a server which I get from the Webservice API some consecutive ArrayList<ServerObject> responses.

I have a class that manages in the UI(user interface) this array in this way:

class DoMarvellousThingsWithTheServerList{

//instance
ServerObject serverObject;


//here come the consecutive ArrayList ItemsToCompare from another class
//and I need to separate  the first  ItemToCompare object with the second ItemToCompare in two different variables,
//and then a third ItemToCompare array should be compared with the second one, then the fourth with the third,
//there is an Utility class called DiffUtil that runs this comparation if I furnish two Array variables oldItem and NewItem

public void InjectFromServer(ArrayList<ServerObject> itemToCompare){

//here should happen the magic
//and every new instance should be loaded also as List in the user interface
//I thought to something like  the operator %2, or to take the Hash of everyObject is coming, or to Serialize the object
// but I do not have any idea what is the most elegant, efficient way to proceed

}

}



ps Is not that I need a solution, as you may know after 5 years in the forum, I finally found a job as developer:) but this is not an assignment I need to solve, so there is any hassle to solve it, is just to sharp my abilities because mimicks a real case I went through some time ago and I could not solve so easy
1 month ago
Are several days, I am thinking just as an intellectual challenge that I have a method that passes a whatever parameter, and I want to catch its stream in two separate variables depending if is odd or even.
This is the use case, I thought was not so easy to realize.
I receive from an API some data, and I need to sort these data alternatively in one variable oldItem, and the next one in a variable newItem so that I can compare oldItem with newItem to spot if the items(  some arrays that go in a list) are the same( using a kind of DiffUtil library

I would anyway assign every  new Array that is "injected" from an external class to an instance variable inside the class

1 month ago

tony narloch wrote:


(off topic)
I confess  was really akin to write curse words when I started my first experiments.
but i guess was sublimated frustration more than real adverse feelings
2 months ago

Pete Letkeman wrote:Interesting for many reasons including, many of the Effective Java concepts have already been implemented in Kotlin.
Now/soon you can read about effective Kotlin programming see
https://leanpub.com/effectivekotlin

Thanks so far I found really informative the book "Kotlin in Action" i won in Java ranch
3 months ago

Pete Letkeman wrote:The same people (Jet Brains) who made Kotlin have also created Anko which is marketed as "Pleasant Android application development".
With the official release of Android Studio 3 Kotlin is baked in, however it does not appear as though Anko is. You can read about Anko on it's GitHub site https://github.com/Kotlin/anko.

From what I gather Anko can help streamline your layouts, SQL, intents, dialogs, fragments and more. There appears to be many different tutorials regarding Anko.
I was wondering:

  • Have you started using Anko?
  • If you have started using Anko that is?

  • I bumped into a course with Anko, but the Android community does not like for layouts, because xml looks as a really efficient way to manage them when are not needed programmatical interventions
    3 months ago

    Jeanne Boyarsky wrote:

    Giovanni Montano wrote:I will work in Dutch and I have been hired for a position where I do not have seniors.


    A mentor doesn't have to be senior to you...


    Good point Jeanne!
    3 months ago
    Thanks all of you, and for the delicious pies.
    I will work in Dutch and I have been hired for a position where I do not have seniors.
    I will do Android/Ios and possibly Machine Learning,Artificial Intelligence based on my skills.

    I am prioritizing what to do to be prepared, really excited
    3 months ago

    Pete Letkeman wrote:

  • As far as I know (I could be wrong) you can only compile an Objective C application for iOS using a Mac/Apple computer.
      - You can create Android programs using Mac/Apple systems.



  • yes, is needed Apple. also I guess there are some workarounds if one cannot afford mac
    3 months ago
    Dear  friends,
    after 5 years of self study yesterday i become a developer

    will start in one month
    want to thank this fanstastic forum that togheter with stackoverflow allowed me to realize this dream.

    I want to thank all the senior that have been really supportive to me, in particular I have to make a special mention to three of you: Campbell Ritchie, Junilu Lacar and Liutaras Vilda

    Focusing allow to get objectives done, even when the external circumstances are not optimal

    Do you have  an ArrayList  of [b]generic [/b<]Suggestions> on how to survive the first month in an agile environment speaking in a language that is not English and I am moderately fluent? The company is based in Haarlem in the Netherlands, people are really nice.
    Looking forward, just resigned from my previous job, I do not need to study always all the weekends and nights anymore after a no coding work, because as most of the developer i will have also 1680+ hours per year to dedicate myself from the morning at this fantastic activity


    3 months ago

    Stephan van Hulst wrote:Well, while this is really interesting stuff, I don't think you really need to know that much about it to be a good Java programmer. Every little bit helps though.


    I was the guy that was breaking all the toys. Cannot stay away from breaking complexity patterns
    3 months ago

    Stephan van Hulst wrote:I don't think they forgot to take out the assert. Remember that this is open source that can be compiled in debug mode and isn't necessarily a reflection of a particular 'build'. Before compilation the asserts might still be removed, or more likely, they're left in because they don't do any harm.

    It's important to distinguish the compiler from the standard libraries. While some classes of the standard libraries might be written in C/C++ and compiled to machine code, I believe the compiler itself can be written in pure Java (ignoring for a minute that it has to use classes from the standard library that might call native code) because it translates Java to Java Bytecode, which by its very nature is platform independent.

    The code for the JVM will likely make heavy use of native code though.


    I see thank you Stephan, still have to learn a lot
    3 months ago
    OK, I eliminate offset, makes semantically sense what you say, names are really important, good code have to tell a story, a novel, and definetly is better to leave at the parameter the expression of the meaning, otherwise looks as an abstract baseline.

    I hate static methods but they make sense when one want to use a static class, if the view get too busy, and you do not use the presenter. by the way I suggest the books of Martin Fowler, I am starting to like them a lot, this nice cheatsheet is fantastic at this purpose
    EDIT: @Junilu for future reference if somebody looks into this post to find solutions.

    I was risking to overarchitecting everything, even easier for my use case, i could resolve like that, eventually adding a static Utility class if want to separate. No need to create a POJO or iterate collections.





    Karl Beecher wrote:Hi,

    In terms of architecture, the book covers general principles of modular programming and object-oriented programming. You'll learn how to build components which have high cohesion, low coupling, clean and reusable interfaces and you'll learn how to build classes which allow for flexible designs.

    Designing good interfaces is a critical element of building large-scale software. Dependency injection is one way--and a fine one, at that--to avoid brittle designs (i.e. designs that tend to break and demand rework when you attempt to change things). Specifically, it is a solution to the problem of a client being responsible for constructing a concrete service object in order to use it. That's not necessarily something a client should do. The server instance should instead be instantiated elsewhere and 'injected' into the client.

    Design patterns do not have their own section in the book, but a few examples of them feature throughout.

    I hope that answers you questions.


    Fantastic looks as a really beautiful book, thanks
    4 months ago