Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Java equals() not working?
New Posts  All Forums:Forum Nav:

Java equals() not working? - Page 2

post #11 of 15
Why not an array concatenating each array element together in a string using a for loop?
post #12 of 15
Quote:
Originally Posted by gregory121295 View Post
Why not an array concatenating each array element together in a string using a for loop?
Because String's concat() method takes exponentially longer to execute based on the length of the String. This absolutely kills performance in large operations (I've seen it bring down applications with data as small as 1GB)

See here for more: http://kaioa.com/node/59
Jesus PC v5.3
(13 items)
 
  
CPUMotherboardGraphicsRAM
i7-950 Gigabyte X58A-UD3R 5850 GSkill 1600 MHz 4x4GB 
Hard DriveOptical DriveOSMonitor
3x1200.12 500GB RAID 0, 2x2TB Deskstar RAID 1 Samsung Writemaster SATA Gentoo, Windows 7 x64 3x 21.5" Samsungs 
PowerCaseMouse
Thermaltake 750W RocketPwn G500 
  hide details  
Reply
Jesus PC v5.3
(13 items)
 
  
CPUMotherboardGraphicsRAM
i7-950 Gigabyte X58A-UD3R 5850 GSkill 1600 MHz 4x4GB 
Hard DriveOptical DriveOSMonitor
3x1200.12 500GB RAID 0, 2x2TB Deskstar RAID 1 Samsung Writemaster SATA Gentoo, Windows 7 x64 3x 21.5" Samsungs 
PowerCaseMouse
Thermaltake 750W RocketPwn G500 
  hide details  
Reply
post #13 of 15
Thread Starter 
Fixed the problem by doing this:
Code:
for(int n = 0; n < numOfSettings; n++){
System.out.println(str[n]);
char[] command = new char[str[n].indexOf(':')];
CharSequence charSeq = java.nio.CharBuffer.wrap(command);
str[n].getChars(0,str[n].indexOf(':'),command,0);
if(currentSetting[n].contains(charSeq)){
System.out.println("Yay!");
}else{
System.out.println(charSeq);
System.out.println(currentSetting[n]);
System.out.println();
}
}
post #14 of 15
Glad to hear it, just don't forget to clear the whitespace after the colon if you need to (and you're keeping the data)!
Jesus PC v5.3
(13 items)
 
  
CPUMotherboardGraphicsRAM
i7-950 Gigabyte X58A-UD3R 5850 GSkill 1600 MHz 4x4GB 
Hard DriveOptical DriveOSMonitor
3x1200.12 500GB RAID 0, 2x2TB Deskstar RAID 1 Samsung Writemaster SATA Gentoo, Windows 7 x64 3x 21.5" Samsungs 
PowerCaseMouse
Thermaltake 750W RocketPwn G500 
  hide details  
Reply
Jesus PC v5.3
(13 items)
 
  
CPUMotherboardGraphicsRAM
i7-950 Gigabyte X58A-UD3R 5850 GSkill 1600 MHz 4x4GB 
Hard DriveOptical DriveOSMonitor
3x1200.12 500GB RAID 0, 2x2TB Deskstar RAID 1 Samsung Writemaster SATA Gentoo, Windows 7 x64 3x 21.5" Samsungs 
PowerCaseMouse
Thermaltake 750W RocketPwn G500 
  hide details  
Reply
post #15 of 15
Thread Starter 
Well thanks for the help!
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Java equals() not working?