Marcello Lippi

Greenhorn
+ Follow
since Apr 23, 2013
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Marcello Lippi

Junilu Lacar wrote:It seems to me a concrete example is needed to clarify the requirements. Plain English descriptions can be inexact and ambiguous and open to individual interpretation.

What I understand is this:

Given a Map<String, Integer> {
 "English" -> 90,
 "Spanish" -> 70,
 "Bahasa" -> 50,
 "Japanese" -> 62,
 "Tamil" -> 5,
 "French" -> 73,
 "German" -> 79
}

The first step of filtering results in a String array containing everything except Bahasa and Tamil since these have values less than 60.

Next step is to sort them in descending order by value in the Map so:

["English", "German", "French", "Spanish", "Japanese"]

That is final result.

Is this the correct interpretation of the requirements?


In my understanding, it should be German, French, Japanese, Spanish, English (sorted descending by String, not by Integer).
1 week ago
Honestly, I would love to see solution for my initial code. Yes, it is extremely ugly, but at least I do understand it. In the same time, your solutions are brilliant, but I don't understand streams completely yet.
1 week ago

Tyoma Sakurakoji wrote:

Marcello Lippi wrote: Hi all,
Then I should sort array list of strings in descending order comparing to its equivalent in hashmap


It seems I doesn't get the whole problem. Are you need to preserve the original order of the input hashmap entries and just reverse it afterwards? If so, then remove sorted call and reverse the resulting list:



I'm getting error

How do I fix it? What should I import before declaring method?
1 week ago

Carey Brown wrote:

Marcello Lippi wrote:Then I should sort array list of strings in descending order comparing to its equivalent in hashmap.


Sorry, I can't quite parse this sentence. "Equivalent" based on what? The key? The Value? It's hash order?


I meant taking keys order from hashmap and displaying it in reverse order comparing to hashmap. It is not just alphabetical reverse order, but reverse comparing to what is in hashmap.
1 week ago
Hi all,
I'm newbie learning java.

My need is to iterate through hashmap with languages names and display those with score 60 or above. This part works well.

Then I should sort array list of strings in descending order comparing to its equivalent in hashmap. Can't really imagine how do I solve this part. Please advise. See my current version of code below. Thanks ahead.

1 week ago
Hi all,
I got map with full duplicates (key and value are duplicated). I need to sort the map by value, it sorts, but duplicates disappear and I need to keep them. Please see my code below.

Java Code:


Console output:


check 1 - list = [1=one, 3=three, 2=two, 1=one, 4=four]
check 2 - list sorted before return = [4=four, 1=one, 1=one, 3=three, 2=two]
{4=four, 1=one, 3=three, 2=two}


As you can see, my two check steps show that duplicates are present, but they disappear on return.
Thanks for any suggestion.
5 months ago
Hi all,

I'm very new to java, tried to write my first program and it works.

I typed in notepad:

//A Very Simple Example
class ExampleProgram {
public static void main(String[] args) {
System.out.println("I'm a Simple Program");
}
}

saved it as ExampleProgram.java

and then compiled it using

javac ExampleProgram.java

Now I can run it:

java ExampleProgram

and it displays text "I'm a Simple Program".

Now the question is - how do I run my program without typing "java [program name]" ? I mean, I'd like rather to run it using some kind of ExampleProgram.exe but without typing "java" before program name.

So I've changed directiory to

C:\oracle\Middleware\jdk160_24\bin

created manifest file

echo Main-Class: ExampleProgram >manifest.txt

created my jar file

jar cvfm ExampleProgram.jar manifest.txt ExampleProgram.class

tried to test result by running my program

ExampleProgram.jar

(It doesn't return any result in command line).

But when I run "java ExampleProgram" it does display "I'm a Simple Program"

What I'm doing wrong now?
5 years ago
Hi all,

I'm total newbie in Java (got 2+ years in Oracle development), my need is to create java web-form for performing insert into Oracle table.
Hope this is correct thread.
How do I start?
Please help me.
5 years ago