• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 10:44
CET 15:44
KST 23:44
  • 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
ByuL: The Forgotten Master of ZvT30Behind the Blue - Team Liquid History Book19Clem wins HomeStory Cup 289HomeStory Cup 28 - Info & Preview13Rongyi Cup S3 - Preview & Info8
Community News
2026 KongFu Cup Announcement3BGE Stara Zagora 2026 cancelled12Blizzard Classic Cup - Tastosis announced as captains15Weekly Cups (March 2-8): ByuN overcomes PvT block4GSL CK - New online series19
StarCraft 2
General
GSL CK - New online series BGE Stara Zagora 2026 cancelled Blizzard Classic Cup - Tastosis announced as captains BGE Stara Zagora 2026 announced ByuL: The Forgotten Master of ZvT
Tourneys
RSL Season 4 announced for March-April PIG STY FESTIVAL 7.0! (19 Feb - 1 Mar) Sparkling Tuna Cup - Weekly Open Tournament 2026 KongFu Cup Announcement [GSL CK] Team Maru vs. Team herO
Strategy
Custom Maps
Publishing has been re-enabled! [Feb 24th 2026] Map Editor closed ?
External Content
The PondCast: SC2 News & Results Mutation # 516 Specter of Death Mutation # 515 Together Forever Mutation # 514 Ulnar New Year
Brood War
General
BGH Auto Balance -> http://bghmmr.eu/ BSL 22 Map Contest — Submissions OPEN to March 10 ASL21 General Discussion Are you ready for ASL 21? Hype VIDEO Gypsy to Korea
Tourneys
[Megathread] Daily Proleagues [BSL22] Open Qualifiers & Ladder Tours IPSL Spring 2026 is here! ASL Season 21 Qualifiers March 7-8
Strategy
Simple Questions, Simple Answers Soma's 9 hatch build from ASL Game 2 Fighting Spirit mining rates Zealot bombing is no longer popular?
Other Games
General Games
Stormgate/Frost Giant Megathread Path of Exile Nintendo Switch Thread PC Games Sales Thread No Man's Sky (PS4 and PC)
Dota 2
Official 'what is Dota anymore' discussion The Story of Wings Gaming
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Five o'clock TL Mafia Mafia Game Mode Feedback/Ideas Vanilla Mini Mafia TL Mafia Community Thread
Community
General
US Politics Mega-thread Mexico's Drug War Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine NASA and the Private Sector
Fan Clubs
The IdrA Fan Club
Media & Entertainment
[Manga] One Piece Movie Discussion! [Req][Books] Good Fantasy/SciFi books
Sports
Formula 1 Discussion 2024 - 2026 Football Thread General nutrition recommendations Cricket [SPORT] TL MMA Pick'em Pool 2013
World Cup 2022
Tech Support
Laptop capable of using Photoshop Lightroom?
TL Community
The Automated Ban List
Blogs
Funny Nicknames
LUCKY_NOOB
Money Laundering In Video Ga…
TrAiDoS
Iranian anarchists: organize…
XenOsky
FS++
Kraekkling
Shocked by a laser…
Spydermine0240
Unintentional protectionism…
Uldridge
ASL S21 English Commentary…
namkraft
Customize Sidebar...

Website Feedback

Closed Threads



Active: 3394 users

The Big Programming Thread - Page 764

Forum Index > General Forum
Post a Reply
Prev 1 762 763 764 765 766 1032 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.
RoomOfMush
Profile Joined March 2015
1296 Posts
September 14 2016 17:41 GMT
#15261
On September 14 2016 07:40 travis wrote:
there will be multiple search terms, and I don't know what they are, so I can't set it to another string

I know I can set it to null, I was just wondering if there was a better option - is empty string a thing?

If you want to solve your problem you should not try to find some kind of hack which incidentally does what you need, instead, simply solve your problem.

You have a data structure which contains a number of data elements. You want to be able to set data elements to be temporarily invalid. Change your data structure or your data elements to allow this.

For example, instead of storing Strings directly in your list, store instances of a class which themselves have a reference to a string and a boolean field which tells you whether this data element is invalid or not. Do not try to hack things together, it will make it harder for you in the future.
WolfintheSheep
Profile Joined June 2011
Canada14127 Posts
September 14 2016 18:49 GMT
#15262
On September 15 2016 02:41 RoomOfMush wrote:
Show nested quote +
On September 14 2016 07:40 travis wrote:
there will be multiple search terms, and I don't know what they are, so I can't set it to another string

I know I can set it to null, I was just wondering if there was a better option - is empty string a thing?

If you want to solve your problem you should not try to find some kind of hack which incidentally does what you need, instead, simply solve your problem.

You have a data structure which contains a number of data elements. You want to be able to set data elements to be temporarily invalid. Change your data structure or your data elements to allow this.

For example, instead of storing Strings directly in your list, store instances of a class which themselves have a reference to a string and a boolean field which tells you whether this data element is invalid or not. Do not try to hack things together, it will make it harder for you in the future.

While I mostly agree, it isn't necessarily bad to have certain values represent a certain state or a generic value. For example, -1 representing wildcards or just "All", or having a date value of 2999-01-01 being "No expiry" or something.

Important thing is to have a standard, so there isn't ambiguity for anyone else dealing with the system. And of course not to use values that would actually overlap with entries using them at face value. Which also means that your chosen values should be obvious to any observer that it's an intentionally out-of-norm entry.

Comes with it's own pitfalls, of course, but sometimes there are reasons not to overload things with flags and additional data overhead. Which all loops around to the general idea of: plan your shit.
Average means I'm better than half of you.
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
September 14 2016 18:55 GMT
#15263
On September 15 2016 03:49 WolfintheSheep wrote:
Show nested quote +
On September 15 2016 02:41 RoomOfMush wrote:
On September 14 2016 07:40 travis wrote:
there will be multiple search terms, and I don't know what they are, so I can't set it to another string

I know I can set it to null, I was just wondering if there was a better option - is empty string a thing?

If you want to solve your problem you should not try to find some kind of hack which incidentally does what you need, instead, simply solve your problem.

You have a data structure which contains a number of data elements. You want to be able to set data elements to be temporarily invalid. Change your data structure or your data elements to allow this.

For example, instead of storing Strings directly in your list, store instances of a class which themselves have a reference to a string and a boolean field which tells you whether this data element is invalid or not. Do not try to hack things together, it will make it harder for you in the future.

While I mostly agree, it isn't necessarily bad to have certain values represent a certain state or a generic value. For example, -1 representing wildcards or just "All", or having a date value of 2999-01-01 being "No expiry" or something.

Important thing is to have a standard, so there isn't ambiguity for anyone else dealing with the system. And of course not to use values that would actually overlap with entries using them at face value. Which also means that your chosen values should be obvious to any observer that it's an intentionally out-of-norm entry.

Comes with it's own pitfalls, of course, but sometimes there are reasons not to overload things with flags and additional data overhead. Which all loops around to the general idea of: plan your shit.

It is generally a bad idea to use a single variable to express multiple things. Exceptions can be made if you're working in a low memory environment and such, but usually it is better to keep stuff separate until you run into a compelling reason not to. Otherwise: what can go wrong will go wrong.
If you have a good reason to disagree with the above, please tell me. Thank you.
Manit0u
Profile Blog Joined August 2004
Poland17693 Posts
September 14 2016 22:53 GMT
#15264
On September 15 2016 03:55 spinesheath wrote:
Show nested quote +
On September 15 2016 03:49 WolfintheSheep wrote:
On September 15 2016 02:41 RoomOfMush wrote:
On September 14 2016 07:40 travis wrote:
there will be multiple search terms, and I don't know what they are, so I can't set it to another string

I know I can set it to null, I was just wondering if there was a better option - is empty string a thing?

If you want to solve your problem you should not try to find some kind of hack which incidentally does what you need, instead, simply solve your problem.

You have a data structure which contains a number of data elements. You want to be able to set data elements to be temporarily invalid. Change your data structure or your data elements to allow this.

For example, instead of storing Strings directly in your list, store instances of a class which themselves have a reference to a string and a boolean field which tells you whether this data element is invalid or not. Do not try to hack things together, it will make it harder for you in the future.

While I mostly agree, it isn't necessarily bad to have certain values represent a certain state or a generic value. For example, -1 representing wildcards or just "All", or having a date value of 2999-01-01 being "No expiry" or something.

Important thing is to have a standard, so there isn't ambiguity for anyone else dealing with the system. And of course not to use values that would actually overlap with entries using them at face value. Which also means that your chosen values should be obvious to any observer that it's an intentionally out-of-norm entry.

Comes with it's own pitfalls, of course, but sometimes there are reasons not to overload things with flags and additional data overhead. Which all loops around to the general idea of: plan your shit.

It is generally a bad idea to use a single variable to express multiple things. Exceptions can be made if you're working in a low memory environment and such, but usually it is better to keep stuff separate until you run into a compelling reason not to. Otherwise: what can go wrong will go wrong.


But sometimes you can also structure parts of data in a way that one set bit provides 2 or more bits of information. It's pretty situational but when you come across it you can't help but feel amazed by it (that is, if it's implemented right and there's no ambiguity about it). It's similar to the old puzzle with scales and 12 identical-looking coins. One of the coins is either lighter or heavier than the others and you have to find out which one it is. You can put as many coins on each arm of the scale as you want but you can't use it more than 3 times before providing a solution.
Time is precious. Waste it wisely.
Acrofales
Profile Joined August 2010
Spain18234 Posts
September 14 2016 23:30 GMT
#15265
On September 15 2016 03:55 spinesheath wrote:
Show nested quote +
On September 15 2016 03:49 WolfintheSheep wrote:
On September 15 2016 02:41 RoomOfMush wrote:
On September 14 2016 07:40 travis wrote:
there will be multiple search terms, and I don't know what they are, so I can't set it to another string

I know I can set it to null, I was just wondering if there was a better option - is empty string a thing?

If you want to solve your problem you should not try to find some kind of hack which incidentally does what you need, instead, simply solve your problem.

You have a data structure which contains a number of data elements. You want to be able to set data elements to be temporarily invalid. Change your data structure or your data elements to allow this.

For example, instead of storing Strings directly in your list, store instances of a class which themselves have a reference to a string and a boolean field which tells you whether this data element is invalid or not. Do not try to hack things together, it will make it harder for you in the future.

While I mostly agree, it isn't necessarily bad to have certain values represent a certain state or a generic value. For example, -1 representing wildcards or just "All", or having a date value of 2999-01-01 being "No expiry" or something.

Important thing is to have a standard, so there isn't ambiguity for anyone else dealing with the system. And of course not to use values that would actually overlap with entries using them at face value. Which also means that your chosen values should be obvious to any observer that it's an intentionally out-of-norm entry.

Comes with it's own pitfalls, of course, but sometimes there are reasons not to overload things with flags and additional data overhead. Which all loops around to the general idea of: plan your shit.

It is generally a bad idea to use a single variable to express multiple things. Exceptions can be made if you're working in a low memory environment and such, but usually it is better to keep stuff separate until you run into a compelling reason not to. Otherwise: what can go wrong will go wrong.

And forgetting to set or unset your flag variable is something that can go just as wrong as using null or -1 to mean it has not been correctly initialized. If you want to distinguish between too many things, I agree, but designating a basket to mean "invalid" is a really common practice, and one I generally agree with..

Code needs to be legible, and adding hundreds of flags is not necessarily the best way of doing that.
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
September 15 2016 01:51 GMT
#15266
is it normal to separate code into methods specifically for organization purposes? even if you are only using the methods once?

I keep failing to make my program, and part of the problem is it feels like I keep trying to fix problems with how my code works and it slowly gets more bloated and then it's super difficult to follow

but if I separated it into methods maybe it would make it easier to follow because it would make it easier for me to have a good idea of what each chunk of code is doing/supposed to do without studying it
Birdie
Profile Blog Joined August 2007
New Zealand4438 Posts
September 15 2016 01:55 GMT
#15267
On September 15 2016 10:51 travis wrote:
is it normal to separate code into methods specifically for organization purposes? even if you are only using the methods once?

I keep failing to make my program, and part of the problem is it feels like I keep trying to fix problems with how my code works and it slowly gets more bloated and then it's super difficult to follow

but if I separated it into methods maybe it would make it easier to follow because it would make it easier for me to have a good idea of what each chunk of code is doing/supposed to do without studying it

This is more or less the idea of SRP (Single Responsibility Principle). Make each method only do one thing (even if it's only called once), and then you can test that method to make sure it's doing that one thing correctly. Even if you're not doing TDD or testing, you can still more easily analyse a small piece of code in one method than a big fat method.
Red classic | A butterfly dreamed he was Zhuangzi | 4.5k, heading to 5k as support!
phar
Profile Joined August 2011
United States1080 Posts
September 15 2016 05:08 GMT
#15268
On September 14 2016 17:34 Morfildur wrote:
Show nested quote +
On September 14 2016 11:15 Blisse wrote:
Why can't you just remove the objects from the list if you know you don't need them?

On September 12 2016 13:25 WarSame wrote:
On September 12 2016 06:52 Blisse wrote:
Yeah, academic integrity policy is intentionally vague so that it's a lot easier on them when they provide proof. Generally it's fine as long as you're just talking about the solution and not given exact pseudo/code. All reasonable professors I've seen encourage discussion, just not discussion with code being written.

I've consulted TL for a bunch of things too.

Instead of giving the problem description, you should abstract it one step up. I know it's a bit harder to do since you're starting out, but asking, "how do you find the smallest range of numbers in a list that contains a given set of numbers?" gives essentially the same solutions, and as long as no one is writing out a program for you, it should be fine asking for help.

-----

Actually it's kind of annoying/interesting that a lot of programming questions essentially rely on tricks that you need to learn first before you can actually solve them. Using sets and dictionaries IMO don't come intuitively, but instead from me reading advice that they're generally how to best solve a problem, and then I base my thinking with that in mind. I think the extreme example is being asked to find a loop in a linked list. No way you can reason yourself to a solution.

I mean, I'm not particularly good, but couldn't you just put the pointer values of each node in a dict when visited, and if you come to a node already in the dict, then you've got a loop?


How would you approach the problem if you couldn't hash the objects because the list is huge?

+ Show Spoiler [hint] +
what if you used two pointers?
+ Show Spoiler [answer] +
what if one pointer moved faster than they other? how were you expected to get to this answer?
+ Show Spoiler +
Obviously I realized I fucked up the interview question :'(

http://www.programmerinterview.com/index.php/data-structures/how-to-find-if-a-linked-list-is-circular-or-has-a-cycle-or-it-ends/



Pointers are tiny, so even a list with a million entries will have pretty much insignificant memory impact compared to the list and data itself, so a simple dictionary solution would still be pretty easy and probably faster, too, since you can abort on the first duplicate node. With the tortoise and hare solution you have to cross the distance that the slower pointer completed already, which means in a completely circular list you pretty much have to check 1.5n elements. The slower pointer crosses half the distance in the time for one complete loop, so now the faster pointer has to move around again until it reaches the slower pointer which is half the loop ahead. You can increase the speed at which the faster pointer moves, but then you'll be slower for partial loops that the faster pointer will circle around multiple times before the slower even enters them.

In any case, the situation is completely academic since you should never have to check in code whether a list is circular or not. You should never actually interact with the nodes directly, only the data they contain, which means that you couldn't even be able to create any loops in a non-circular list if you wanted to. If you create your own linked list implementation then your code shouldn't allow for the possibility of a loop when you don't want one and making such a potentially expensive check at runtime inside a library is generally a bad idea.


Just to note... in an interview question you'll be simplifying many things. E.g. in this case they make the data structure a list so it's easier to deal with, because that's not the important thing you're dealing with. In reality it might be some other structure that you want to check for a loop.

Depending on where you end up working, you may need to deal with many things that don't fit in memory on a single machine (or any affordable set of machines). The data may have problems you'd need to figure out - a loop is a simple example.


The point is, if you threw a real work problem at someone in an interview setting and tried to have them solve it, you'd never hire anyone.
Who after all is today speaking about the destruction of the Armenians?
BluzMan
Profile Blog Joined April 2006
Russian Federation4235 Posts
September 15 2016 10:17 GMT
#15269
On September 15 2016 10:51 travis wrote:
is it normal to separate code into methods specifically for organization purposes? even if you are only using the methods once?

I keep failing to make my program, and part of the problem is it feels like I keep trying to fix problems with how my code works and it slowly gets more bloated and then it's super difficult to follow

but if I separated it into methods maybe it would make it easier to follow because it would make it easier for me to have a good idea of what each chunk of code is doing/supposed to do without studying it


Well, sometimes "god functions" are inevitable because not all things actual code does are easily separable into distinct steps and sometimes you need to do something complex that involves hundreds of lines of code and no idea on even how to name those separate steps should you figure them out. But it's still worth it at least for the reason of limiting the lifetime of local variables. It's much easier to reason about a piece of code when you have solid proof that any variables involved only exist in the span of the current screen and your changes can not have any effect on code you don't see. If having trouble naming, you can achieve the same by creating custom anonymous scopes within your god functions, but that's not possible in certain languages. I prefer nested scopes to separate methods when they're not easily named because reading code like "calculate_X_part_4(input, results_of_parts_1-3);" is even worse than 700-line "calculate_X(input);". Otherwise, when you see a standalone piece of code with a comment on what it does right above, go for it and make the comment into a method name.

Also, in C++ you can either explicitly inline those functions or rely on compilers detecting the "only called once" pattern and inlining them automatically, meaning zero overhead. Just make sure they are not exposed to the outside world as a part of some public interface.
You want 20 good men, but you need a bad pussy.
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
September 15 2016 17:24 GMT
#15270
On September 15 2016 08:30 Acrofales wrote:
Show nested quote +
On September 15 2016 03:55 spinesheath wrote:
On September 15 2016 03:49 WolfintheSheep wrote:
On September 15 2016 02:41 RoomOfMush wrote:
On September 14 2016 07:40 travis wrote:
there will be multiple search terms, and I don't know what they are, so I can't set it to another string

I know I can set it to null, I was just wondering if there was a better option - is empty string a thing?

If you want to solve your problem you should not try to find some kind of hack which incidentally does what you need, instead, simply solve your problem.

You have a data structure which contains a number of data elements. You want to be able to set data elements to be temporarily invalid. Change your data structure or your data elements to allow this.

For example, instead of storing Strings directly in your list, store instances of a class which themselves have a reference to a string and a boolean field which tells you whether this data element is invalid or not. Do not try to hack things together, it will make it harder for you in the future.

While I mostly agree, it isn't necessarily bad to have certain values represent a certain state or a generic value. For example, -1 representing wildcards or just "All", or having a date value of 2999-01-01 being "No expiry" or something.

Important thing is to have a standard, so there isn't ambiguity for anyone else dealing with the system. And of course not to use values that would actually overlap with entries using them at face value. Which also means that your chosen values should be obvious to any observer that it's an intentionally out-of-norm entry.

Comes with it's own pitfalls, of course, but sometimes there are reasons not to overload things with flags and additional data overhead. Which all loops around to the general idea of: plan your shit.

It is generally a bad idea to use a single variable to express multiple things. Exceptions can be made if you're working in a low memory environment and such, but usually it is better to keep stuff separate until you run into a compelling reason not to. Otherwise: what can go wrong will go wrong.

And forgetting to set or unset your flag variable is something that can go just as wrong as using null or -1 to mean it has not been correctly initialized. If you want to distinguish between too many things, I agree, but designating a basket to mean "invalid" is a really common practice, and one I generally agree with..

Code needs to be legible, and adding hundreds of flags is not necessarily the best way of doing that.

Additional flags are not the only way to deal with such things. Most of the time when you would need a flag - or a special value that has the same meaning - and consequently an if or switch that checks the flag (often in multiple places), there is a clean polymorphic solution hidden in somewhere. Like a null object for example.

On September 15 2016 19:17 BluzMan wrote:
Well, sometimes "god functions" are inevitable because not all things actual code does are easily separable into distinct steps and sometimes you need to do something complex that involves hundreds of lines of code and no idea on even how to name those separate steps should you figure them out..

While it might be true that sometimes a problem has a certain inherent complexity that forces longer functions, I would argue that these are extremely rare. Hundreds of lines is clearly excessive and you never should accept that kind of code as inevitable. A nice solution might not present itself right away, but if you can come back after a while and have another go at breaking it down, you probably will get a step closer.
If you have a good reason to disagree with the above, please tell me. Thank you.
Manit0u
Profile Blog Joined August 2004
Poland17693 Posts
Last Edited: 2016-09-15 23:31:42
September 15 2016 21:39 GMT
#15271
On September 16 2016 02:24 spinesheath wrote:
Show nested quote +
On September 15 2016 19:17 BluzMan wrote:
Well, sometimes "god functions" are inevitable because not all things actual code does are easily separable into distinct steps and sometimes you need to do something complex that involves hundreds of lines of code and no idea on even how to name those separate steps should you figure them out..

While it might be true that sometimes a problem has a certain inherent complexity that forces longer functions, I would argue that these are extremely rare. Hundreds of lines is clearly excessive and you never should accept that kind of code as inevitable. A nice solution might not present itself right away, but if you can come back after a while and have another go at breaking it down, you probably will get a step closer.


Past 2 years of my life in a nutshell... Most of the time I'm doing tasks that others find too ungrateful/hard to do, which for the most part involves fixing 10 year old code with functions that span thousands of lines of code.
Time is precious. Waste it wisely.
Manit0u
Profile Blog Joined August 2004
Poland17693 Posts
September 16 2016 10:45 GMT
#15272
Tip of the day: In SQLite databases don't make id UNSIGNED. It'll disable the autoincrement...
Time is precious. Waste it wisely.
Birdie
Profile Blog Joined August 2007
New Zealand4438 Posts
September 17 2016 04:22 GMT
#15273
I want to code something up, probably in PHP unless the arguments to use Ruby are particularly compelling. What's a good unit testing framework for PHP?
Red classic | A butterfly dreamed he was Zhuangzi | 4.5k, heading to 5k as support!
TheEmulator
Profile Blog Joined July 2010
28099 Posts
September 17 2016 04:23 GMT
#15274
Isn't PHPUnit supposed to be ok. I don't do any PHP though so I could be incredibly wrong
Administrator
tofucake
Profile Blog Joined October 2009
Hyrule19194 Posts
September 17 2016 13:11 GMT
#15275
PHPUnit is standard
Liquipediaasante sana squash banana
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
Last Edited: 2016-09-19 20:13:23
September 19 2016 20:11 GMT
#15276
What does "generic notation" mean?

context: my java class gave us a small assignment. part of the assignment needs my class to implement the comparable interface. and then it says, "don't forget to use generic notation".

what does generic notation actually mean



is this just fancy terminology for when you label something, say arraylist, with the object type? like: Arraylist<bullshitobject> ?
Manit0u
Profile Blog Joined August 2004
Poland17693 Posts
September 19 2016 20:32 GMT
#15277
On September 17 2016 13:22 Birdie wrote:
I want to code something up, probably in PHP unless the arguments to use Ruby are particularly compelling. What's a good unit testing framework for PHP?


PHPUnit for unit testing. Behat for BDD.
Time is precious. Waste it wisely.
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
Last Edited: 2016-09-19 20:39:28
September 19 2016 20:37 GMT
#15278
On September 20 2016 05:11 travis wrote:
What does "generic notation" mean?

context: my java class gave us a small assignment. part of the assignment needs my class to implement the comparable interface. and then it says, "don't forget to use generic notation".

what does generic notation actually mean



is this just fancy terminology for when you label something, say arraylist, with the object type? like: Arraylist<bullshitobject> ?

In ArrayList<T>, T is a generic parameter that could be any type, and ArrayList<T> is a generic class. Nothing fancy about the word "generic", though I don't usually see the word "notation" thrown in. So I suppose that's what they are after. Sometimes you restrict generic parameters to subclasses of certain types or require them to implement certain interfaces. For example a SortedList<T> would probably require T to implement the Comparable interface.
If you have a good reason to disagree with the above, please tell me. Thank you.
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
Last Edited: 2016-09-19 20:39:02
September 19 2016 20:38 GMT
#15279
Whoops, Quote instead of Edit.
If you have a good reason to disagree with the above, please tell me. Thank you.
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
Last Edited: 2016-09-19 20:48:12
September 19 2016 20:42 GMT
#15280
I am still a little confused

What we are doing is writing a class called hurricane

in it we implement Comparable

then we write a compareTo method, and an equals method

the goal of course being to compare hurricanes (by default, we are comparing them by "windspeed" ints)

Now it would seem to me that I would be doing:

public Class Hurricane implements Comparable<Hurricane> {

...
...

public int compareTo(Hurricane other) {

....
...

}}


but are you saying that they want:

public Class Hurricane implements Comparable<T> {

...

public int compareTo(Object other) {
...


?




edit: no... that would make no sense
compareTo must take hurricanes
so I don't get what they are asking for



edit 2: maybe they want me to cast the object to type hurricane?
Prev 1 762 763 764 765 766 1032 Next
Please log in or register to reply.
Live Events Refresh
WardiTV Team League
12:00
Group B
WardiTV899
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
MindelVK 35
StarCraft: Brood War
Sea 56863
Calm 16142
firebathero 6870
Horang2 2456
GuemChi 1810
Jaedong 1743
BeSt 500
Mini 436
EffOrt 405
Stork 320
[ Show more ]
Soma 277
Rush 262
actioN 138
Dewaltoss 115
Last 104
Mind 80
ToSsGirL 73
Backho 52
sorry 40
Barracks 40
JulyZerg 35
Hm[arnc] 30
IntoTheRainbow 29
Nal_rA 25
GoRush 18
Terrorterran 13
NaDa 10
ivOry 10
SilentControl 8
Dota 2
Gorgc5946
BananaSlamJamma140
League of Legends
Rex49
Counter-Strike
fl0m1247
x6flipin403
kRYSTAL_27
Heroes of the Storm
Khaldor325
Liquid`Hasu224
Other Games
B2W.Neo2542
Liquid`RaSZi1105
byalli630
DeMusliM262
Fuzer 178
KnowMe176
Hui .164
Mew2King73
crisheroes9
Organizations
Dota 2
PGL Dota 2 - Main Stream14948
Other Games
gamesdonequick872
ComeBackTV 262
StarCraft: Brood War
lovetv 18
Kim Chul Min (afreeca) 8
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 16 non-featured ]
StarCraft 2
• StrangeGG 59
• musti20045 36
• Adnapsc2 10
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• blackmanpl 29
• iopq 1
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• C_a_k_e 1485
Upcoming Events
Patches Events
2h 17m
BSL
5h 17m
GSL
17h 17m
Wardi Open
21h 17m
Monday Night Weeklies
1d 2h
WardiTV Team League
1d 21h
PiGosaur Cup
2 days
Kung Fu Cup
2 days
OSC
3 days
The PondCast
3 days
[ Show More ]
KCM Race Survival
3 days
WardiTV Team League
3 days
Replay Cast
4 days
KCM Race Survival
4 days
WardiTV Team League
4 days
Korean StarCraft League
5 days
uThermal 2v2 Circuit
6 days
BSL
6 days
Liquipedia Results

Completed

Proleague 2026-03-13
WardiTV Winter 2026
Underdog Cup #3

Ongoing

KCM Race Survival 2026 Season 1
Jeongseon Sooper Cup
BSL Season 22
RSL Revival: Season 4
Nations Cup 2026
ESL Pro League S23 Finals
ESL Pro League S23 Stage 1&2
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual

Upcoming

CSL Elite League 2026
ASL Season 21
Acropolis #4 - TS6
2026 Changsha Offline CUP
Acropolis #4
IPSL Spring 2026
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
NationLESS Cup
Stake Ranked Episode 2
CS Asia Championships 2026
IEM Atlanta 2026
Asian Champions League 2026
PGL Astana 2026
BLAST Rivals Spring 2026
CCT Season 3 Global Finals
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
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 © 2026 TLnet. All Rights Reserved.