• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 03:17
CEST 09:17
KST 16:17
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
[ASL19] Finals Recap: Standing Tall10HomeStory Cup 27 - Info & Preview18Classic wins Code S Season 2 (2025)16Code S RO4 & Finals Preview: herO, Rogue, Classic, GuMiho0TL Team Map Contest #5: Presented by Monster Energy6
Community News
Weekly Cups (June 30 - July 6): Classic Doubles4[BSL20] Non-Korean Championship 4x BSL + 4x China9Flash Announces Hiatus From ASL66Weekly Cups (June 23-29): Reynor in world title form?14FEL Cracov 2025 (July 27) - $8000 live event22
StarCraft 2
General
The GOAT ranking of GOAT rankings How Esports Is Reshaping the Future of Competitive Weekly Cups (June 30 - July 6): Classic Doubles The SCII GOAT: A statistical Evaluation Weekly Cups (June 23-29): Reynor in world title form?
Tourneys
RSL: Revival, a new crowdfunded tournament series FEL Cracov 2025 (July 27) - $8000 live event Sparkling Tuna Cup - Weekly Open Tournament WardiTV Mondays Korean Starcraft League Week 77
Strategy
How did i lose this ZvP, whats the proper response Simple Questions Simple Answers
Custom Maps
[UMS] Zillion Zerglings
External Content
Mutation # 481 Fear and Lava Mutation # 480 Moths to the Flame Mutation # 479 Worn Out Welcome Mutation # 478 Instant Karma
Brood War
General
i aint gon lie to u bruh... BGH Auto Balance -> http://bghmmr.eu/ ASL20 Preliminary Maps [ASL19] Finals Recap: Standing Tall SC uni coach streams logging into betting site
Tourneys
[BSL20] Non-Korean Championship 4x BSL + 4x China [BSL20] Grand Finals - Sunday 20:00 CET CSL Xiamen International Invitational The Casual Games of the Week Thread
Strategy
Simple Questions, Simple Answers I am doing this better than progamers do.
Other Games
General Games
Nintendo Switch Thread Stormgate/Frost Giant Megathread Path of Exile What do you want from future RTS games? Beyond All Reason
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread Vanilla Mini Mafia
Community
General
Stop Killing Games - European Citizens Initiative Summer Games Done Quick 2025! US Politics Mega-thread Russo-Ukrainian War Thread Summer Games Done Quick 2024!
Fan Clubs
SKT1 Classic Fan Club! Maru Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece [\m/] Heavy Metal Thread
Sports
Formula 1 Discussion 2024 - 2025 Football Thread NBA General Discussion TeamLiquid Health and Fitness Initiative For 2023 NHL Playoffs 2024
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List
Blogs
momentary artworks from des…
tankgirl
Culture Clash in Video Games…
TrAiDoS
from making sc maps to makin…
Husyelt
StarCraft improvement
iopq
Customize Sidebar...

Website Feedback

Closed Threads



Active: 673 users

The Big Programming Thread - Page 811

Forum Index > General Forum
Post a Reply
Prev 1 809 810 811 812 813 1031 Next
Thread Rules
1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution.
2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20)
3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible.
4. Use [code] tags to format code blocks.
Fwmeh
Profile Joined April 2008
1286 Posts
December 06 2016 19:08 GMT
#16201
On December 07 2016 02:20 travis wrote:
So, the semester is coming to an end.
I am gonna need to come up with a project. Learning a new language, going through some book (hopefully interesting), or building something...

Any suggestions for someone that really only knows Java? Something that might look good on a resume for internships?


Read https://mitpress.mit.edu/sicp/full-text/book/book.html.

Btw, the idea that education should focus on tools is 100% ridiculous to me. When I was hired for my current job (enterprise .Net stuff in the insurance biz) I had not written a single line of C#. IMHO, education should be for demonstrating that you are able to learn new things quickly.

And if your place is too lenient with bad coding practise, it is a sure sign to find something better. In a productive environment, a bright new graduate should be brought up to speed fairly quickly, through pairing and code reviews.
A parser for things is a function from strings to lists of pairs of things and strings
Acrofales
Profile Joined August 2010
Spain17971 Posts
December 06 2016 19:09 GMT
#16202
On December 07 2016 03:49 tofucake wrote:
pshhh

even on windows I use shell. cygwin master race

sh? Please tell me you don't use sh... bash is defo the best shell.
RoomOfMush
Profile Joined March 2015
1296 Posts
Last Edited: 2016-12-06 19:22:19
December 06 2016 19:21 GMT
#16203
On December 06 2016 19:56 spinesheath wrote:
There's a difference between teaching CS and teaching how to build an OS/DB/Compiler. Those are "how do I connect a kitchen sink" and "how do I install a bath tub". It's a pointless exercise to anyone who is interested in the actual science part, and the wrong focus for anyone interested in becoming a software developer.

The stuff I can get behind for a CS degree is all the math. That's great stuff. The semi-practical stuff that teaches little more than how to be a bad programmer and about as much knowledge about a DB as you can gather in 5 minutes from wikipedia - not so much.

But they dont teach us how to build an OS. It is our exercise to build the OS. They teach us how an OS works and functions and expect us to learn how to build that OS by ourself. They teach the theoretical background and we are expected to work out the practical details after being given the theory.

Same with the DBMS stuff. They teach us all the different approaches that can be done, all the historical stuff that had happened but didnt work, and all the exotic techniques that are currently being tested but not yet established. Then we are asked to implement one ourself and we can choose how we want to do it. The newer, better algorithms that perhaps are more complicated to do right? Or perhaps the tried and true old stuff that may be a little bit slower. The result is not that important but rather how we got there.

I actually really like that approach. I think its the right thing to do. We learn the theory, we are forced to learn the practical stuff, and we can brag with the "interesting" things we have created.
tofucake
Profile Blog Joined October 2009
Hyrule19031 Posts
December 06 2016 19:24 GMT
#16204
On December 07 2016 04:09 Acrofales wrote:
Show nested quote +
On December 07 2016 03:49 tofucake wrote:
pshhh

even on windows I use shell. cygwin master race

sh? Please tell me you don't use sh... bash is defo the best shell.

yeah, but I was talking more about (generic shell) vs (windows batch)
Liquipediaasante sana squash banana
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
December 06 2016 21:06 GMT
#16205
On December 07 2016 04:21 RoomOfMush wrote:
Show nested quote +
On December 06 2016 19:56 spinesheath wrote:
There's a difference between teaching CS and teaching how to build an OS/DB/Compiler. Those are "how do I connect a kitchen sink" and "how do I install a bath tub". It's a pointless exercise to anyone who is interested in the actual science part, and the wrong focus for anyone interested in becoming a software developer.

The stuff I can get behind for a CS degree is all the math. That's great stuff. The semi-practical stuff that teaches little more than how to be a bad programmer and about as much knowledge about a DB as you can gather in 5 minutes from wikipedia - not so much.

But they dont teach us how to build an OS. It is our exercise to build the OS. They teach us how an OS works and functions and expect us to learn how to build that OS by ourself. They teach the theoretical background and we are expected to work out the practical details after being given the theory.

Same with the DBMS stuff. They teach us all the different approaches that can be done, all the historical stuff that had happened but didnt work, and all the exotic techniques that are currently being tested but not yet established. Then we are asked to implement one ourself and we can choose how we want to do it. The newer, better algorithms that perhaps are more complicated to do right? Or perhaps the tried and true old stuff that may be a little bit slower. The result is not that important but rather how we got there.

I actually really like that approach. I think its the right thing to do. We learn the theory, we are forced to learn the practical stuff, and we can brag with the "interesting" things we have created.

Obviously the details will differ from university to university. But from my experience, it's more like "to install a kitchen sink, you can either use these items like that, or these other items that other way", and then they don't even mention that it's important to know how to use your tools (programming). It's stuff that I can look up on wikipedia in no time, with no scientific value.

Take the compiler example: From a scientific perspective, a compiler is just a function that takes some data a (source coude) and returns some data b (binary). Nothing of value here unless you go into implementation details. You might use the common stuff like a lexer, parser, tokenizer, what have you. But then that's still just a composition of simple functions. You learn how to compose functions in math classes. What you should learn in the more practical classes - if you have any - is how to do that property.

Also, if you use programming as a tool, you should have a very good understanding of it, just like any other tool. That should at least be made clear.

Anyways, I personally had to take a bunch of courses that I felt were neither abstract enough to provide konwledge that could be applied to other stuff, nor concrete enough to be of any practical use. It was a waste of time. Might be different elsewhere.

Ok, enough ranting on that topic from me.
If you have a good reason to disagree with the above, please tell me. Thank you.
Manit0u
Profile Blog Joined August 2004
Poland17244 Posts
Last Edited: 2016-12-06 22:32:44
December 06 2016 22:31 GMT
#16206
In my personal opinion CS is a useless degree, just like economy. If you need the maths and theory, you'll be better off just studying maths. If you want to learn programming, well, there's no real university course that will teach you how to do that.

Before you ask why the economy analogy: I've got a friend who finished economy and maths with flying colors and worked for some really big companies that have to do with stocks and what not. What he told me is that if you want to do something relevant economy-wise then no one will hire you after economy. People after maths will be much better with all the mathematical stuff needed while people after humanities will be much better with people skills, that's why big companies hire them and then send them to specific economy courses so they can brush up on their lingo and other skills as necessary.

I think that CS is facing pretty much the same problem. By doing some theory and some practice you don't really get enough of both. You can alleviate some of that by getting hired as a programmer early enough during your studies, but then you're still better off with going pure maths. Likewise, if you want to do pure theoretical stuff you should too just get a degree in mathematics and learn just enough programming (and/or some computer theory) in your free time or from extracurricular courses.

TL;DR: CS, just like economy is not focused enough to give you any real advantage when it comes down to doing anything past the most basic stuff.
Time is precious. Waste it wisely.
Birdie
Profile Blog Joined August 2007
New Zealand4438 Posts
December 06 2016 22:35 GMT
#16207
I don't think all of my uni courses were useless with regards to practical programming, particularly the introductory courses and the object oriented course. But they certainly didn't really enforce clean coding practices, nor teach about source control for the vast majority of them, and didn't do any kind of TDD or testing generally beyond "does it work on the assignment test cases the professor uses". All of that I've either picked up at my job or in my free time out of my own interest.

Pure maths wouldn't be that useful IMO for preparing for a programming job.
Red classic | A butterfly dreamed he was Zhuangzi | 4.5k, heading to 5k as support!
meatpudding
Profile Joined March 2011
Australia520 Posts
December 06 2016 23:50 GMT
#16208
On December 07 2016 02:20 travis wrote:
So, the semester is coming to an end.
I am gonna need to come up with a project. Learning a new language, going through some book (hopefully interesting), or building something...

Any suggestions for someone that really only knows Java? Something that might look good on a resume for internships?


The SC2 Map Analyser needs an update, if you want to practice your C.
Be excellent to each other.
meatpudding
Profile Joined March 2011
Australia520 Posts
December 06 2016 23:58 GMT
#16209
On December 07 2016 07:31 Manit0u wrote:
In my personal opinion CS is a useless degree, just like economy. If you need the maths and theory, you'll be better off just studying maths. If you want to learn programming, well, there's no real university course that will teach you how to do that.

Before you ask why the economy analogy: I've got a friend who finished economy and maths with flying colors and worked for some really big companies that have to do with stocks and what not. What he told me is that if you want to do something relevant economy-wise then no one will hire you after economy. People after maths will be much better with all the mathematical stuff needed while people after humanities will be much better with people skills, that's why big companies hire them and then send them to specific economy courses so they can brush up on their lingo and other skills as necessary.

I think that CS is facing pretty much the same problem. By doing some theory and some practice you don't really get enough of both. You can alleviate some of that by getting hired as a programmer early enough during your studies, but then you're still better off with going pure maths. Likewise, if you want to do pure theoretical stuff you should too just get a degree in mathematics and learn just enough programming (and/or some computer theory) in your free time or from extracurricular courses.

TL;DR: CS, just like economy is not focused enough to give you any real advantage when it comes down to doing anything past the most basic stuff.


CS is far from useless, but don't make the mistake of thinking that CS is Software Engineering. I suppose CS is very heavy on the maths and logic of computing in theory, which is relevant to certain applications, but not general programming. For example, if you're doing scientific computing and you need to get the most calculations out of your cpu cycles, then you want to apply CS to find algorithms that will crunch your matrices. Another example is cryptography, which relies heavily on CS to ensure that their methods are secure.
Be excellent to each other.
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
December 07 2016 01:38 GMT
#16210
As someone who is pursuing a C.S. degree, what I am learning (in my major) sure does not feel useless. I suppose I could have learned all of this on my own, but that could be said for literally any degree.
emperorchampion
Profile Blog Joined December 2008
Canada9496 Posts
December 07 2016 02:36 GMT
#16211
On December 07 2016 10:38 travis wrote:
As someone who is pursuing a C.S. degree, what I am learning (in my major) sure does not feel useless. I suppose I could have learned all of this on my own, but that could be said for literally any degree.


Yeah this is really it. Also you get a piece of paper saying you can do certain things.
TRUEESPORTS || your days as a respected member of team liquid are over
phar
Profile Joined August 2011
United States1080 Posts
December 07 2016 03:40 GMT
#16212
travis has it.

Also then there's the (probably unfortunate) reality that entry level jobs at some of the highest paying gigs' interviews are heavily biased towards recent cs graduates. (It's getting better, but slowly)
Who after all is today speaking about the destruction of the Armenians?
Yurie
Profile Blog Joined August 2010
11807 Posts
Last Edited: 2016-12-07 14:02:21
December 07 2016 13:48 GMT
#16213
I have an assignment to make a phone book in java. I can do that but I can't do it according to the requirements in the assignment. I assume I am making an elementary mistake. I'll post one of the sections I get stuck at implementing.

I seem to have some mistake in my put code that then chains to the rest and creates havoc. I have no idea what I am doing wrong though.

At the top I have

private Map<String, LinkedList<String>> phoneBook;
public MapPhoneBook() {
phoneBook = new HashMap<String, LinkedList<String>>();
}

The put itself:
/** 
* Associates the specified number with the specified
* name in this phone book.
* post: If the specified name is not present in this phone book,
* the specified name is added and associated with
* the specified number. Otherwise the specified
* number is added to the set of number associated with name.
* @param name The name for which a phone number is to be added
* @param number The number associated with the specified name
* @return true if the specified name and number was inserted
*/
@Override
public boolean put(String name, String number) {
if(phoneBook.containsKey(name)) {
LinkedList<String> numbers = phoneBook.get(name);
if(!numbers.contains(number)) {
numbers.add(number);
return true;
}
} else {
LinkedList<String> numbers = new LinkedList<String>();
numbers.add(number);
phoneBook.put(name, numbers);
return true;
}
return false;
}


Tried the following to see the results:
public class Testphoneb {
public static void main(String[] args) {
Map<String, String> pb = new TreeMap<String, String>();
System.out.println("Size: " + pb.size());
pb.put("a", "1");
pb.put("a", "2");
pb.put("a", "3");
pb.put("b", "2");
System.out.println("Size: " + pb.size());
System.out.println("Get a: " + pb.get("a"));
}
}

When using debug in eclipse with a stop before put b, 2. I find size 1 and a, 3 values as the only thing in the memory section. When I thought it would be 1,2,3.

Edit, old post.
+ Show Spoiler +

/**
* Retrieves a set of phone numbers for the specified name. If the
* specified name is not present in this phone book an empty set is
* returned.
* @param name The name whose associated phone numbers are to be returned
* @return The phone numbers associated with the specified name
*/
Set<String> findNumbers(String name);


My attempt that returns the following error: java.lang.ClassCastException: java.util.LinkedList cannot be cast to java.util.Set

public Set<String> findNumbers(String name) {
Set<String> number = new HashSet<String>();
number = (Set<String>) phoneBook.get(name);
return number;
}


I defined phonebook as
private Map<String, LinkedList<String>> phoneBook;
phoneBook = new HashMap<String, LinkedList<String>>();


It also fails the required testcode when filled with 3 numbers connected to name a. So I think I have a mistake in my put section that makes one name, multiple numbers replace instead of add.
private void fill() {
pb.put("a", "1");
pb.put("c", "3");
pb.put("b", "2");
pb.put("a", "2");
pb.put("b", "1");
pb.put("a", "3");
pb.put("c", "2");
pb.put("aaa", "111");
}

assertEquals("Wrong size for number set to a:", 3, pb.findNumbers("a").size());


If not required to use a set (which is the area I think I don't understand) it would be something like
public List<String> findNumber(String name) {
if(phoneBook.containsKey(name)) {
return phoneBook.get(name);
}
return new LinkedList<String>();
}


Can anybody provide some hints on how I should use set to get it working here? This is just one of 4 places using set in this assignment, so an exact solution would not solve the entire homework but help me with understanding how sets work.
Targe
Profile Blog Joined February 2012
United Kingdom14103 Posts
Last Edited: 2016-12-07 13:56:39
December 07 2016 13:55 GMT
#16214
during my degree we've covered a range of languages (c, java, haskell, prolog, lisp family etc.) , how the hardware behind works, stuff on networking and software engineering methods (plus group projects where weve produced software based off initial requirements given to us).

i probably could have learned java, python or something on my own but not the skills and knowledge surrounding the languages

theres also the maths stuff on algorithms etc. for more background knowledge and my final year courses where ive been able to choose specific areas to pursue further (cryptography, parallel computing, compilers, advanced graphics) which has been interesting so far
11/5/14 CATACLYSM | The South West's worst Falco main
Blitzkrieg0
Profile Blog Joined August 2010
United States13132 Posts
Last Edited: 2016-12-07 14:19:06
December 07 2016 13:59 GMT
#16215
Why did you decide to use a LinkedList? A LinkedList is not a set so you either need to get the LinkedList and then convert it to a Set or change your Map to have a different type of data in it. The latter makes more sense to me, but it might not work everywhere in your assignment. LinkedList should basically never be used in java; I'm pretty sure ArrayList is implemented in a way that makes it strictly better. If you're casting something in java you should double check to make sure you're not doing something wrong typically. There are exceptions, but if your classes are set up properly then you should almost never need to.

You also have confusion with what a Map is I think. The Map is a key:value pairing. If you put the same value into the Map three times you'll just change the value it is paired with. That's why the size of your map is one. You've put the a:1 pair into the map and then changed it to a:2 and then changed it to a:3. Instead you need to see if that value is in the map already. If it is then you need to get that data structure (you're using a LinkedList right now) and add the new value to the List.
I'll always be your shadow and veil your eyes from states of ain soph aur.
Yurie
Profile Blog Joined August 2010
11807 Posts
Last Edited: 2016-12-07 14:05:44
December 07 2016 14:03 GMT
#16216
On December 07 2016 22:59 Blitzkrieg0 wrote:
Why did you decide to use a LinkedList? A LinkedList is not a set so you either need to get the LinkedList and then convert it to a Set or change your Map to have a different type of data in it. The latter makes more sense to me, but it might not work everywhere in your assignment. LinkedList should basically never be used in java; I'm pretty sure ArrayList is implemented in a way that makes it strictly better. If you're casting something in java you should double check to make sure you're not doing something wrong typically. There are exceptions, but if your classes are set up properly then you should almost never need to.

You also have confusion with what a Map is I think. The Map is a key:value pairing. If you put the same value into the Map three times you'll just change the value. Instead you need to see if that value is in the map already. If it is then you need to get your storage (you're using a LinkedList right now) and add the new value to the List.


Thank you. I'll try using an arraylist instead, there is no specific reason for using a linkedlist, just first thing I though of. So I should be finding the arraylist in question and inputting a value in it. You are right in the value being replaced which is my problem.
Blitzkrieg0
Profile Blog Joined August 2010
United States13132 Posts
December 07 2016 14:14 GMT
#16217
On December 07 2016 23:03 Yurie wrote:
Show nested quote +
On December 07 2016 22:59 Blitzkrieg0 wrote:
Why did you decide to use a LinkedList? A LinkedList is not a set so you either need to get the LinkedList and then convert it to a Set or change your Map to have a different type of data in it. The latter makes more sense to me, but it might not work everywhere in your assignment. LinkedList should basically never be used in java; I'm pretty sure ArrayList is implemented in a way that makes it strictly better. If you're casting something in java you should double check to make sure you're not doing something wrong typically. There are exceptions, but if your classes are set up properly then you should almost never need to.

You also have confusion with what a Map is I think. The Map is a key:value pairing. If you put the same value into the Map three times you'll just change the value. Instead you need to see if that value is in the map already. If it is then you need to get your storage (you're using a LinkedList right now) and add the new value to the List.


Thank you. I'll try using an arraylist instead, there is no specific reason for using a linkedlist, just first thing I though of. So I should be finding the arraylist in question and inputting a value in it. You are right in the value being replaced which is my problem.


Keep in mind that the ArrayList isn't a Set either so you'll still need to do some conversion.
I'll always be your shadow and veil your eyes from states of ain soph aur.
Acrofales
Profile Joined August 2010
Spain17971 Posts
Last Edited: 2016-12-07 14:21:10
December 07 2016 14:18 GMT
#16218
Unless you have a very specific reason to use LinkedList, an arraylist is always better. But given that you want numbers to be unique, why not use a HashSet (which will give you most of the functionality you want)?

That said, it should affect performance, and not functionality, because you already test whether the element is present when you insert.

However, I don't quite understand your debugging info. Your phonebook having size one before you add b seems correct: it has one entry: <a, LinkedList object>. Your linked list should have 3 values (1, 2, 3), not your map.
Yurie
Profile Blog Joined August 2010
11807 Posts
Last Edited: 2016-12-07 14:34:40
December 07 2016 14:26 GMT
#16219
On December 07 2016 23:18 Acrofales wrote:
Unless you have a very specific reason to use LinkedList, an arraylist is always better. But given that you want numbers to be unique, why not use a HashSet (which will give you most of the functionality you want)?

That said, it should affect performance, and not functionality.

However, I don't quite understand your debugging info. Your phonebook having size one before you add b seems correct: it has one entry: <a, LinkedList object>. Your linked list should have 3 values (1, 2, 3), not your map.


So nested HashSets instead of using a string, arraylist (or linkedlist)? I am not sure how that works but it might be easier since I am required to export it to a set. Else I assume I would have to do something like the following but with the size of the arraylist.
      try {
for(int i = 0; i < size-1; i++) {
set.add(count[i]);
}



As for adding the numbers one by one I found the following on stackexchange that I will experiment a bit with:
String key = "mango";
int number = 42;
if (map.get(key) == null) {
map.put(key, new ArrayList<Integer>());
}
map.get(key).add(number);


I only get the last value 3 when I actually check the memory in the variables. So regardless that my code should return 2 it doesn't have the right thing in memory since my put code is wrong.

Edit, thanks for the replies people. I'll try working at it a bit before asking for help again. Great advice.

Edit 2, tasted nested hashmaps and it seems a bad idea since I need double strings in the nested one and only have one input remaining, the phone number.
Blitzkrieg0
Profile Blog Joined August 2010
United States13132 Posts
Last Edited: 2016-12-07 14:41:16
December 07 2016 14:40 GMT
#16220
On December 07 2016 23:26 Yurie wrote:+ Show Spoiler +

On December 07 2016 23:18 Acrofales wrote:
Unless you have a very specific reason to use LinkedList, an arraylist is always better. But given that you want numbers to be unique, why not use a HashSet (which will give you most of the functionality you want)?

That said, it should affect performance, and not functionality.

However, I don't quite understand your debugging info. Your phonebook having size one before you add b seems correct: it has one entry: <a, LinkedList object>. Your linked list should have 3 values (1, 2, 3), not your map.


So nested HashSets instead of using a string, arraylist (or linkedlist)? I am not sure how that works but it might be easier since I am required to export it to a set. Else I assume I would have to do something like the following but with the size of the arraylist.
      try {
for(int i = 0; i < size-1; i++) {
set.add(count[i];
}



As for adding the numbers one by one I found the following on stackexchange that I will experiment a bit with:
String key = "mango";
int number = 42;
if (map.get(key) == null) {
map.put(key, new ArrayList<Integer>());
}
map.get(key).add(number);


I only get the last value 3 when I actually check the memory in the variables. So regardless that my code should return 2 it doesn't have the right thing in memory since my put code is wrong.

Edit, thanks for the replies people. I'll try working at it a bit before asking for help again. Great advice.


Sets are the smarter way to do it. A Set is just a List that can't have duplicate values. Having a duplicate phone number does not make sense. I was under the impression that you had to use a List for the assignment, but if you can choose then do use a Set instead of an ArrayList.
I'll always be your shadow and veil your eyes from states of ain soph aur.
Prev 1 809 810 811 812 813 1031 Next
Please log in or register to reply.
Live Events Refresh
Next event in 2h 43m
[ Submit Event ]
Live Streams
Refresh
StarCraft: Brood War
GuemChi 1256
actioN 1009
Tasteless 243
Leta 234
PianO 232
Soma 123
Dewaltoss 71
Movie 36
Sacsri 32
EffOrt 31
[ Show more ]
Free 27
yabsab 26
Bale 18
Dota 2
ODPixel304
XcaliburYe257
League of Legends
JimRising 640
Counter-Strike
Stewie2K1778
shoxiejesuss22
Other Games
summit1g9722
SortOf117
Mew2King86
NeuroSwarm57
Liquid`RaSZi56
Organizations
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
Other Games
gamesdonequick0
StarCraft: Brood War
sctven
[ Show 15 non-featured ]
StarCraft 2
• Berry_CruncH366
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• lizZardDota2114
League of Legends
• Rush1431
• Lourlo1188
• HappyZerGling136
Upcoming Events
Sparkling Tuna Cup
2h 43m
WardiTV European League
8h 43m
MaNa vs sebesdes
Mixu vs Fjant
ByuN vs HeRoMaRinE
ShoWTimE vs goblin
Gerald vs Babymarine
Krystianer vs YoungYakov
PiGosaur Monday
16h 43m
The PondCast
1d 2h
WardiTV European League
1d 4h
Jumy vs NightPhoenix
Percival vs Nicoract
ArT vs HiGhDrA
MaxPax vs Harstem
Scarlett vs Shameless
SKillous vs uThermal
uThermal 2v2 Circuit
1d 8h
Replay Cast
1d 16h
RSL Revival
2 days
ByuN vs SHIN
Clem vs Reynor
Replay Cast
2 days
RSL Revival
3 days
Classic vs Cure
[ Show More ]
FEL
3 days
RSL Revival
4 days
FEL
4 days
FEL
4 days
CSO Cup
4 days
BSL20 Non-Korean Champi…
4 days
Bonyth vs QiaoGege
Dewalt vs Fengzi
Hawk vs Zhanhun
Sziky vs Mihu
Mihu vs QiaoGege
Zhanhun vs Sziky
Fengzi vs Hawk
Sparkling Tuna Cup
5 days
RSL Revival
5 days
FEL
5 days
BSL20 Non-Korean Champi…
5 days
Bonyth vs Dewalt
QiaoGege vs Dewalt
Hawk vs Bonyth
Sziky vs Fengzi
Mihu vs Zhanhun
QiaoGege vs Zhanhun
Fengzi vs Mihu
Liquipedia Results

Completed

BSL Season 20
HSC XXVII
Heroes 10 EU

Ongoing

JPL Season 2
BSL 2v2 Season 3
Acropolis #3
KCM Race Survival 2025 Season 2
CSL 17: 2025 SUMMER
Copa Latinoamericana 4
Jiahua Invitational
Championship of Russia 2025
RSL Revival: Season 1
Murky Cup #2
BLAST.tv Austin Major 2025
ESL Impact League Season 7
IEM Dallas 2025
PGL Astana 2025
Asian Champions League '25
BLAST Rivals Spring 2025
MESA Nomadic Masters
CCT Season 2 Global Finals
IEM Melbourne 2025

Upcoming

2025 ACS Season 2: Qualifier
CSLPRO Last Chance 2025
CSL Xiamen Invitational
2025 ACS Season 2
CSLPRO Chat StarLAN 3
K-Championship
uThermal 2v2 Main Event
SEL Season 2 Championship
FEL Cracov 2025
Esports World Cup 2025
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2025 TLnet. All Rights Reserved.