• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 11:39
CEST 17:39
KST 00:39
  • 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
[ASL22] Ro24 Preview: Siren's Call7[ASL22] Ro24 Preview: Summer's End9Serral wins HomeStory Cup 2915Serral wins Maestros of the Game 244ByuL, and the Limitations of Standard Play3
Community News
New 3v3 BGH Ladder (and more) on ShieldBattery!20Weekly Cups (August 17-23): Zerg dominate the week2Weekly Cups (August 10-16): SHIN doubles2GSTL Returns in 2026!45Weekly Cups (Aug 3-9): Protoss get shut out7
StarCraft 2
General
SC4ALL II: SC2 Player Announcement 6/8 - Maru Weekly Cups (August 17-23): Zerg dominate the week PhD study /w SC2 - help with a survey! How would you feel about frequent/monthly balance patches for SC2? Geoff 'iNcontroL' Robinson has passed away
Tourneys
2026 GSTL Announcement IntoTheTV X SOOP SC2 League : Weekly & Monthly PIG STY FESTIVAL 8.0! (13 - 23 August) Sparkling Tuna Cup - Weekly Open Tournament WORTEX 2026 - Hungarian SC2 Finals Budapest
Strategy
[G] Having the right mentality to improve
Custom Maps
Nexus Wars 2021 GUIDE [M] (2) Industrial Park
External Content
Mutation # 540 Dodge This The PondCast: SC2 News & Results Mutation # 539 Thunder Dome Mutation # 538 Media Blackout
Brood War
General
New 3v3 BGH Ladder (and more) on ShieldBattery! BW General Discussion Looking 4 Yaroslav: Enemy, Korchagin, WCG, Ukraine 25 Years Since Brood War Patch 1.08 Pros React To: First 'Fastest' Map in ASL History
Tourneys
[ASL22] Ro24 Group E Escore Tournament - Season 3 [ASL22] Ro24 Group D [ASL22] Ro24 Group B
Strategy
Replay Review Process - What do you do? Odyssey Mineral Stack Saturation Fighting Spirit mining rates Any training maps people recommend?
Other Games
General Games
Nintendo Switch Thread General RTS Discussion Thread Anyone here play Quakeworld back in the day? Stormgate/Frost Giant Megathread EVE Corporation
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
[TL LoL EUW IHs] Teemo shall perish TSM pausing esports and CLG Dead
Heroes of the Storm
Heroes of the Storm 2.0
Hearthstone
Deck construction bug
TL Mafia
TL Mafia Power Rank TL Mafia Community Thread NeO.D_StephenKing vs This Guy From 1 Million Dance
Community
General
Canadian Politics Mega-thread US Politics Mega-thread Artificial Intelligence Thread Russo-Ukrainian War Thread Dating: How's your luck?
Fan Clubs
The Creator Fan Club MarineLorD Fan Club The ShoWTimE Fan Club
Media & Entertainment
Movie Discussion! Anime Discussion Thread
Sports
Football (Soccer) Thread TeamLiquid Health and Fitness Initiative For 2023 MLB/Baseball 2023 NBA General Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread Simple Questions Simple Answers FPS when play League Of Legend on laptop
TL Community
The Automated Ban List Northern Ireland Global Starcraft
Blogs
Young Players Exit Esports E…
TrAiDoS
LOCKPICKING NOOB
LUCKY_NOOB
Cathedral Of CS And NY pizza a…
FuDDx
Please support my new stand…
Peanutsc
Hello guys!
LIN1s
Customize Sidebar...

Website Feedback

Closed Threads



Active: 4679 users

Official 'what is Dota anymore' discussion - Page 9945

Forum Index > Dota 2 General
Post a Reply
Prev 1 9943 9944 9945 9946 9947 10601 Next
Artisreal
Profile Joined June 2009
Germany9235 Posts
February 01 2019 13:04 GMT
#198881
On February 01 2019 18:39 ahswtini wrote:
daily reminder to say no to epic games store

I don't have time for metro anyway
passive quaranstream fan
teddyoojo
Profile Blog Joined June 2011
Germany22369 Posts
February 01 2019 13:25 GMT
#198882
can someone explain to me why in the second method apparently array[j] refers to the sorted array instead of the original unsorted one given as parameter for the method? i thought the original array in the main method does not get changed by smallest();
+ Show Spoiler +
public static int smallest(int[] array) {
int[] clone = array;
Arrays.sort(clone);
return clone[0];
}
public static int indexOfTheSmallest(int[] array) {
int i = smallest(array);
for(int j = 0; j < array.length; j++) {
if(array[j] == i) {
return j;
}
}
return -1;
}
Esports historian since 2000. Creator of 'The Universe' and 'The best scrambled Eggs 2013'. Host of 'Star Wars Marathon 2015'. Thinker of 'teddyoojo's Thoughts'. Earths and Moons leading CS:GO expert. Lord of the Rings.
intotheheart
Profile Blog Joined January 2011
Canada33091 Posts
Last Edited: 2019-02-01 15:06:17
February 01 2019 14:57 GMT
#198883
On February 01 2019 01:31 ahswtini wrote:
im surprised everyone isnt playing LANGRISSER

I want to, the Facebook ads look pretty great honestly. But I don't wanna take attention away from Azur Lane, you know?

Teddy I think what happens when you use int[] clone = array, you copy the memory reference instead of the array values, such that any changes to clone will affect array since they change the same address in memory. If you want to just clone the values, you should use

int []clone = array.clone()

instead which will copy all the values.

https://www.geeksforgeeks.org/array-copy-in-java/
kiss kiss fall in love
Nevuk
Profile Blog Joined March 2009
United States16280 Posts
February 01 2019 15:07 GMT
#198884
I've run into a situation where declaring a new array didn't even clear the array and resulted in a somewhat hilarious situation of adding the entire array to itself recursively. Had to use array.clear() , Java can be dumb.
teddyoojo
Profile Blog Joined June 2011
Germany22369 Posts
February 01 2019 15:57 GMT
#198885
On February 01 2019 23:57 intotheheart wrote:
Show nested quote +
On February 01 2019 01:31 ahswtini wrote:
im surprised everyone isnt playing LANGRISSER

I want to, the Facebook ads look pretty great honestly. But I don't wanna take attention away from Azur Lane, you know?

Teddy I think what happens when you use int[] clone = array, you copy the memory reference instead of the array values, such that any changes to clone will affect array since they change the same address in memory. If you want to just clone the values, you should use

int []clone = array.clone()

instead which will copy all the values.

https://www.geeksforgeeks.org/array-copy-in-java/

thanks, this worked of course(i just hadnt realized u cant copy arrays like that):
for (int i=0; i<a.length; i++)
b[i] = a[i];
Esports historian since 2000. Creator of 'The Universe' and 'The best scrambled Eggs 2013'. Host of 'Star Wars Marathon 2015'. Thinker of 'teddyoojo's Thoughts'. Earths and Moons leading CS:GO expert. Lord of the Rings.
PoulsenB
Profile Joined June 2011
Poland7754 Posts
February 01 2019 16:09 GMT
#198886
Every time someone discusses coding I regret studying philology instead of sciences/engineering

feelsbad
IdrA fan forever <3 || the clueless one || Marci must be protected at all costs
Unleashing
Profile Joined March 2011
Denmark14978 Posts
February 01 2019 16:11 GMT
#198887
If I hadn't found a job fast I might've regretted studying biology, being unemployed sucks.

But I found a job in the field I care about, so that's nice.
From the Ghastly Eyrie I can see to the ends of the world, and from this vantage point I declare with utter certainty that this one is in the bag!
intotheheart
Profile Blog Joined January 2011
Canada33091 Posts
February 01 2019 16:27 GMT
#198888
Yeah I'm in a weird spot now where I may get an interview from a company that's for what I wanted to do really badly in my undergrad, but now that I'm working more with materials science, I really want to see if I can do more stuff here instead. Although the company does a lot of other stuff too, so it's not like I'm locked out of doing materials or hardware.

kiss kiss fall in love
PhoenixVoid
Profile Blog Joined December 2011
Canada32755 Posts
February 01 2019 16:51 GMT
#198889
On February 02 2019 01:09 PoulsenB wrote:
Every time someone discusses coding I regret studying philology instead of sciences/engineering

feelsbad

Not too late to learn a language. I empathize with your situation as a fellow non-STEM major. I think I might have to start very soon, given that I might have to look into being a technical writer and nowadays 90% of jobs in that field demand at least knowledge in one programming language.
I'm afraid of demented knife-wielding escaped lunatic libertarian zombie mutants
Erasme
Profile Blog Joined February 2011
Bahamas15899 Posts
Last Edited: 2019-02-01 17:06:48
February 01 2019 17:06 GMT
#198890
On February 02 2019 00:07 Nevuk wrote:
I've run into a situation where declaring a new array didn't even clear the array and resulted in a somewhat hilarious situation of adding the entire array to itself recursively. Had to use array.clear() , Java can be dumb.

you got some memory issues
i dont see how if you declare a new array, you still get the old one in java
unless you don't use 'new'
https://www.youtube.com/watch?v=d7lxwFEB6FI “‘Drain the swamp’? Stupid saying, means nothing, but you guys loved it so I kept saying it.”
teddyoojo
Profile Blog Joined June 2011
Germany22369 Posts
Last Edited: 2019-02-01 17:49:56
February 01 2019 17:48 GMT
#198891
while were at it and since the ppl i usually spam for this kinda stuff arent online rn:

is there a better way to write this? seems ugly
+ Show Spoiler +

public static void swap(int[] array, int index1, int index2) {
// int var1 = index1;
// int var2 = index2;
int var3 = array[index1];
int var4 = array[index2];
array[index1] = var4;
array[index2] = var3;
}

lol nvm i commented out the obviously irrelevant part now, doesnt look too wrong anymore
Esports historian since 2000. Creator of 'The Universe' and 'The best scrambled Eggs 2013'. Host of 'Star Wars Marathon 2015'. Thinker of 'teddyoojo's Thoughts'. Earths and Moons leading CS:GO expert. Lord of the Rings.
Slomo
Profile Joined November 2010
Germany7198 Posts
February 01 2019 18:22 GMT
#198892
you can do it with only 1 variable.
In pseudocode
a = 1
b = 2

c = b
b = a
a = c

Adapt it to your Java needs.
RIP DOUBLE TI OG | #18 never forget
Nevuk
Profile Blog Joined March 2009
United States16280 Posts
Last Edited: 2019-02-01 18:35:52
February 01 2019 18:35 GMT
#198893
On February 02 2019 02:06 Erasme wrote:
Show nested quote +
On February 02 2019 00:07 Nevuk wrote:
I've run into a situation where declaring a new array didn't even clear the array and resulted in a somewhat hilarious situation of adding the entire array to itself recursively. Had to use array.clear() , Java can be dumb.

you got some memory issues
i dont see how if you declare a new array, you still get the old one in java
unless you don't use 'new'

I checked , it was a local list variable actually.

Nw= new arraylist
Path.filter.Foreachorderered ->{
List p = methodthatreturnsobject
Nw.add(p)
p.clear
}

Shitty pseudo code because I'm on mobile, but that should give you the idea. If I didn't add clear then it just recursively added to itself.
Erasme
Profile Blog Joined February 2011
Bahamas15899 Posts
February 01 2019 18:52 GMT
#198894
On February 02 2019 03:35 Nevuk wrote:
Show nested quote +
On February 02 2019 02:06 Erasme wrote:
On February 02 2019 00:07 Nevuk wrote:
I've run into a situation where declaring a new array didn't even clear the array and resulted in a somewhat hilarious situation of adding the entire array to itself recursively. Had to use array.clear() , Java can be dumb.

you got some memory issues
i dont see how if you declare a new array, you still get the old one in java
unless you don't use 'new'

I checked , it was a local list variable actually.

Nw= new arraylist
Path.filter.Foreachorderered ->{
List p = methodthatreturnsobject
Nw.add(p)
p.clear
}

Shitty pseudo code because I'm on mobile, but that should give you the idea. If I didn't add clear then it just recursively added to itself.

so you'd end up with something like a aab aababc ? lmao
https://www.youtube.com/watch?v=d7lxwFEB6FI “‘Drain the swamp’? Stupid saying, means nothing, but you guys loved it so I kept saying it.”
CorsairHero
Profile Joined December 2008
Canada9491 Posts
February 01 2019 19:28 GMT
#198895
On February 02 2019 00:57 teddyoojo wrote:
Show nested quote +
On February 01 2019 23:57 intotheheart wrote:
On February 01 2019 01:31 ahswtini wrote:
im surprised everyone isnt playing LANGRISSER

I want to, the Facebook ads look pretty great honestly. But I don't wanna take attention away from Azur Lane, you know?

Teddy I think what happens when you use int[] clone = array, you copy the memory reference instead of the array values, such that any changes to clone will affect array since they change the same address in memory. If you want to just clone the values, you should use

int []clone = array.clone()

instead which will copy all the values.

https://www.geeksforgeeks.org/array-copy-in-java/

thanks, this worked of course(i just hadnt realized u cant copy arrays like that):
for (int i=0; i<a.length; i++)
b[i] = a[i];

please use memcpy or the equivalent function thx
© Current year.
teddyoojo
Profile Blog Joined June 2011
Germany22369 Posts
February 01 2019 19:39 GMT
#198896
i dont know what thats supposed to be
Esports historian since 2000. Creator of 'The Universe' and 'The best scrambled Eggs 2013'. Host of 'Star Wars Marathon 2015'. Thinker of 'teddyoojo's Thoughts'. Earths and Moons leading CS:GO expert. Lord of the Rings.
Erasme
Profile Blog Joined February 2011
Bahamas15899 Posts
February 01 2019 19:54 GMT
#198897
http://manpagesfr.free.fr/man/man3/memcpy.3.html
https://www.youtube.com/watch?v=d7lxwFEB6FI “‘Drain the swamp’? Stupid saying, means nothing, but you guys loved it so I kept saying it.”
Erasme
Profile Blog Joined February 2011
Bahamas15899 Posts
Last Edited: 2019-02-01 19:56:01
February 01 2019 19:55 GMT
#198898
On February 02 2019 04:54 Erasme wrote:
http://manpagesfr.free.fr/man/man3/memcpy.3.html

"=" doesn't work everytime
wops
https://www.youtube.com/watch?v=d7lxwFEB6FI “‘Drain the swamp’? Stupid saying, means nothing, but you guys loved it so I kept saying it.”
CorsairHero
Profile Joined December 2008
Canada9491 Posts
February 01 2019 20:13 GMT
#198899
On February 01 2019 18:39 ahswtini wrote:
daily reminder to say no to epic games store

whats wrong with it
© Current year.
intotheheart
Profile Blog Joined January 2011
Canada33091 Posts
Last Edited: 2019-02-01 20:25:20
February 01 2019 20:20 GMT
#198900
Teddy, what you did was perfectly fine and reasonable. There are one-line methods to getting the job done, but they should all give the equivalent output if you do it correctly. Doing things step-by-step's a good habit until things get easier, since you'll be able to make sense of the code.

I think that Erasme's saying that you may find that using certain array methods like clone() to be more practical when you have larger data structures, but there's nothing wrong with just copying things over one at a time when you're doing ints.
kiss kiss fall in love
Prev 1 9943 9944 9945 9946 9947 10601 Next
Please log in or register to reply.
Live Events Refresh
GSL
11:00
2026 GSTL: Main Stage Day 2
IntoTheiNu 906
CranKy Ducklings SOOP202
Rogue43
ByuN (SOOP)43
Rex37
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
ByuN (SOOP) 43
Rogue 43
Rex 37
Cure 31
Trap 13
StarCraft: Brood War
Shuttle 3087
Soma 601
BeSt 477
Soulkey 397
Snow 315
Rush 247
hero 136
Barracks 108
Sea.KH 79
Hyun 75
[ Show more ]
Sharp 69
Pusan 63
Liquid`Ret 58
Dewaltoss 39
910 35
zelot 21
Rock 19
soO 18
Free 17
IntoTheRainbow 12
ajuk12(nOOB) 12
Terrorterran 11
NaDa 11
SilentControl 10
Dota 2
qojqva4212
Dendi2309
Counter-Strike
ScreaM2046
olofmeister942
Super Smash Bros
Mew2King44
Other Games
Gorgc4354
B2W.Neo1086
hiko1051
Liquid`RaSZi976
Beastyqt696
fl0m519
crisheroes398
ToD193
Liquid`VortiX153
ArmadaUGS139
KnowMe94
Chillindude81
QueenE68
UpATreeSC42
Trikslyr37
[ Show 16 non-featured ]
StarCraft 2
• StrangeGG 59
• Shameless 50
• mYiSmile146
• IndyKCrew
• Migwel
• Kozan
• intothetv
• AfreecaTV YouTube
StarCraft: Brood War
• HerbMon 18
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• WagamamaTV599
League of Legends
• Nemesis4268
• TFBlade1172
Other Games
• Shiphtur180
Upcoming Events
PiGosaur Cup
8h 21m
Afreeca Starleague
18h 21m
Mini vs Calm
Queen vs EffOrt
Replay Cast
1d 8h
The PondCast
1d 18h
Replay Cast
2 days
Escore
2 days
IntoTheTV X SOOP
2 days
Korean StarCraft League
3 days
GSL
3 days
Replay Cast
4 days
[ Show More ]
Sparkling Tuna Cup
4 days
WardiTV Weekly
4 days
GSL
6 days
Liquipedia Results

Completed

CSL Season 22: Qualifier 1
PiG Sty Festival 8.0
META DYMY #4

Ongoing

KCM Race Survival 2026 Season 3
K-JUNGMAN
ASL Season 22
Super Anchor Qualifying S3
CSL Season 22: Qualifier 2
RSL Revival: Season 6
Light Tournament 2026
Esports World Cup 2026
Esports World Cup 2026: LCQ
BLAST Bounty Summer 2026
BLAST Bounty Summer Qual
Stake Ranked Episode 3
XSE Pro League 2026
IEM Cologne Major 2026

Upcoming

BSL 2026 LAN: Kraków
CSL 2026 AUTUMN (S22)
Acropolis #5
Acropolis #5 - TRS
Blizzard Classic Cup 2026
Acropolis #5 - GSA
Acropolis #5 - GSB
HSC XXX
SC4ALL II: StarCraft II
Kung Fu Cup 2026 Grand Finals
RSL Offline Finals
Calamity Invitational
Big Dog Cup 2026 Div 1
IEM Beijing 2026
Stake Ranked Episode 5
PGL Masters Bucharest 2026
Thunderpick World Champ. '26
ESL Pro League Season 24
Stake Ranked Episode 4
1win Private Club #1
Logitech G Play Connect 2026
SL StarSeries Fall 2026
FISSURE Playground #3
BLAST Open Fall 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.