• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 13:11
CET 19:11
KST 03:11
  • 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
Greatest Players of All Time: Addendum - Dark10Team Liquid Map Contest #2312[ASL22] Finals Preview: Sweet Victory!12[ASL22] Ro4 Preview: Mirror Mirror6[ASL22] Ro8 Preview: Within Reach5
Community News
[BSL23] ProLeague RO82Serral wins 2026 RSL Season Finals12Weekly Cups (Nov 16-22): MaxPax doubles, Dark heats up0BSL 2v2 ProLeague Season 44Weekly Cups (Nov 9-15): Clem and herO take over6
StarCraft 2
General
Best SC2 Parody Song about 2v2? Greatest Players of All Time: Addendum - Dark Serral wins 2026 RSL Season Finals How do you feel about the mass reverts in the 5.0.17 PTR? Weekly Cups (Nov 16-22): MaxPax doubles, Dark heats up
Tourneys
Sparkling Tuna Cup - Weekly Open Tournament Kung Fu Cup - 2026 Grand Finals (Nov 24-29) RSL goes to London! 2026 Offline Finals Nov 21-22 soO & FanTaSy return! SC2 Kevin Scrim 4v4 (Nov 16) ISSL:Premier#2 Announcement
Strategy
[H] ZvP Mid-Late Game: Stalkers Collossi HT
Custom Maps
[G] How to playtest arcade maps Starcraft 2 Advance [D] the control group Simple Questions/Answers
External Content
Mutation # 553 Undermined The PondCast: SC2 News & Results Mutation # 552 Secret Storm Mutation # 551 Robotic Revival
Brood War
General
New ASL23 Maps BW General Discussion List of top players active on ShieldBattery SOOP Announces New Women's Monthly Tournament screpdb: new Starcraft reporting tool
Tourneys
2v2v2v2 Tournament Stage 2: Players BSL 2v2 ProLeague Season 4 Ultimate Battle Event [BSL23] ProLeague RO8
Strategy
Request - 3-factory/fast timings as Terran Pluto's TvP 5Marine 2Medic Push Simple Questions, Simple Answers Infested Terran strategies in 2026
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread The PlayStation 5 Warcraft III: The Frozen Throne Free Space RTS Game, optimised f. Phone/Tablet etc
Dota 2
League of Legends
[TL LoL EUW IHs] Teemo shall perish
Heroes of the Storm
Heroes of the Storm 2.0
Hearthstone
Deck construction bug
TL Mafia
TL Mafia Community Thread
Community
General
US Politics Mega-thread Artificial Intelligence Thread The Games Industry And ATVI The Chess Thread Russo-Ukrainian War Thread
Fan Clubs
INnoVation Fan Club Fan Club Resource Thread
Media & Entertainment
Anime Discussion Thread Movie Discussion!
Sports
Football (Soccer) Thread Formula 1 Discussion TeamLiquid Health and Fitness Initiative For 2023
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List Recent Gifted Posts
Blogs
[Kickstarter] The Roman E…
LUCKY_NOOB
On Parallel Lives in Fascis…
p4NDemik
The time I organised my…
AssyrianKing
Why I built Repalyzer (1.1.…
BlueStar
Innovate or Game Over?
TrAiDoS
ShieldBattery on Mac
Kraekkling
James Bond movies ranking - pa…
Topin
StarCraft improvement
iopq
Customize Sidebar...

Website Feedback

Closed Threads



Active: 11164 users

Official 'what is Dota anymore' discussion - Page 9945

Forum Index > Dota 2 General
Post a Reply
Prev 1 9943 9944 9945 9946 9947 10602 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
Poland7771 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
Canada32761 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 10602 Next
Please log in or register to reply.
Live Events Refresh
OSC
23:45
OSC 5000
WardiTV765
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
elazer 131
ProTech98
SteadfastSC 54
BRAT_OK 45
StarCraft: Brood War
Dewaltoss 121
Shine 56
Hyun 46
Pusan 45
Aegong 29
iFU.spx 5
Dota 2
qojqva3240
420jenkins411
BananaSlamJamma258
Counter-Strike
pashabiceps2209
zeus244
Heroes of the Storm
Trikslyr46
MindelVK8
Other Games
Grubby2786
FrodaN1045
Coldzera 790
B2W.Neo715
Mlord623
Beastyqt585
PiGStarcraft333
crisheroes161
RotterdaM138
Mew2King99
ArmadaUGS63
Organizations
Other Games
EGCTV813
gamesdonequick487
[ Show 18 non-featured ]
StarCraft 2
• Shameless 19
• printf 6
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• Migwel
StarCraft: Brood War
• ChaeLyn 12
• Michael_bg 11
• FirePhoenix7
• Pr0nogo 7
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• WagamamaTV771
Other Games
• Shiphtur283
• imaqtpie25
• tFFMrPink 9
Upcoming Events
BSL
1h 49m
Ret vs TerrOr
UltrA vs Bonyth
Kung Fu Cup
16h 49m
Solar vs Rogue
herO vs TBD
BSL
1d 1h
Kyrie vs JDConan
Dewalt vs eOnzErG
Replay Cast
1d 4h
WardiTV Weekly
1d 17h
Ultimate Battle
1d 17h
Sparkling Tuna Cup
2 days
PiGosaur Cup
3 days
The PondCast
4 days
KCM Race Survival
4 days
[ Show More ]
Replay Cast
5 days
CranKy Ducklings
6 days
Liquipedia Results

Completed

Sijosae Cup
RSL Offline Finals
Underdog Cup 2026 Div 2-3

Ongoing

Acropolis #5
KCM Race Survival 2026 Season 4
International ShieldBattery League
BSL Season 23
IPSL Winter 2026-27
CSL Season 23: Qualifier 1
Sector 591
CSL Season 23: Qualifier 2
Kung Fu Cup 2026 Grand Finals
Calamity Cup Div. A Season 8
PGL Major Singapore 2026
Stake Ranked Episode 6
BLAST Rivals Fall 2026
IEM Beijing 2026
PGL Masters Bucharest 2026
Stake Ranked Episode 5
1win Private Club #2
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

Upcoming

YSL S4
SC4ALL II: Brood War
CSL 2026 Winter (S23) - 3v3
CSL 2026 Winter (S23)
NBSL 2026 Xiamen LAN
BSL 23: Non-Korean Championship
HSC XXX
Stellar Fest 2: Lunar Cup
StarCraft2 Weekly Open Tournament 2026 Grand Finals
SC4ALL II: StarCraft II
IEM Kraków 2027
PGL Bucharest 2027
BLAST Bounty Winter 2027
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.