The reason a simple "=" won't work for the list copy (Collections.copy(listcopy, l)) is because: When you write listcopy=l, for some reason, it doesn't copy the letters, only HOW MUCH letters there are, leaving you with a bunch of nulls. Collections.copy DOES copy the letters, giving you an exact copy instead of a bunch of nulls.
This man literally has tutorials on everything computers. I wish I could understand how one brain can hold so much knowledge. Bucky the demigod of computing! For real tho, you're and inspiration! Thank you for everything!
public class Bucky { public static void main(String[] args) { Character[] ray = {'p', 'r', 'n'}; List<Character> l = new ArrayList<Character>(Arrays.asList(ray)); System.out.println("List is: "); output(l);
Can someone just give me a hint about this: When i use the Enhanced for loop, WITH these >>> {} my OUTPUT method shows everything like this: p w n But when i do the Enhanced for loop WITHOUT these >>> {} it shows like this: p w n
My question is, why these {} do this?? Its strange…
Without declaring the visibility of a method, it would be default visibility, which is public. However, a good programmer should always declare a method as public or private. Private methods are appropriate for when they only need to be used in the same class. Using private methods to do each step of a more advanced method makes the program much more readable, both by the author and others.
If you don't want to add "static", that's fine. But you need to instantiate and object before you use it. something like bucky b = new bucky(); and b.print("test"); hopefully i answered you questions.
you can totally put "public " or nothing in front of it, it would just make other classes able to use that method. in this case, there's no other class that needs to use that method, so we put private(total up to you). This means there will be an error if other class try to instantiate the bucky.print() method.
And about static, if we don't need many different objects, we only need to functionality of that method, then we use "static", like the System.out.print method.
"static" means that you don't have to instantiate an new object when you want to use the method, you can use it directly. and private means that this method is only accessible within the class. the opposite is public, a public method can be called from outside the class.
Oh my god -_- I spent 15 minutes searching for my error and I had a semi colon after
for(Character xyz: thelist); <<– that 1.. pff 😛
System.out.printf("%s ", xyz);
With the seperate method it is easier because you only have to make one for loop instead of typing in a printf() method multiple times (The explanation probably sucked but I hope it made a little bit of sense 🙂 )
The reason a simple "=" won't work for the list copy (Collections.copy(listcopy, l)) is because:
When you write listcopy=l, for some reason, it doesn't copy the letters, only HOW MUCH letters there are, leaving you with a bunch of nulls.
Collections.copy DOES copy the letters, giving you an exact copy instead of a bunch of nulls.
xxx…mhmmm 😉
xxx…mhmmm 😉
Why do you need an iterator if u can just loop through lists?
This man literally has tutorials on everything computers. I wish I could understand how one brain can hold so much knowledge. Bucky the demigod of computing! For real tho, you're and inspiration! Thank you for everything!
2:12 A better letter than "x"? Damn man 🙁
the output method was redundant, you can just use System.out.println(List);
Good videos nevertheless 🙂
Puberty can be tough Bucky; I get it
can someone explain why we must create an array for "listCopy"?
Why cant we do something like:
Character[] ray = { 'p', 'w', 'n' };
List<Character> i = new ArrayList<Character>(Arrays.asList(ray));
//and then..
List<Character> listCopy = new ArrayList<Character>();
// Copy contents of list into listcopy
Collections.copy(listCopy, i);
Great job man, best regards from Sweden 🙂 watching this in 2016!
2:49 "…let's go ahead and tighten this up…"
You forgot to say "That's what she said"!
import java.util.*;
public class Bucky {
public static void main(String[] args) {
Character[] ray = {'p', 'r', 'n'};
List<Character> l = new ArrayList<Character>(Arrays.asList(ray));
System.out.println("List is: ");
output(l);
Collections.reverse(l);
System.out.println("After reverse: ");
output(l);
Character[] newRay = new Character[3];
List<Character> listCopy = new ArrayList<Character>(Arrays.asList(newRay));
Collections.copy(listCopy, l);
System.out.println("Copy of list:");
output(listCopy);
Collections.fill(l, 'X');
System.out.println("After filling the list: ");
output(l);
}
private static void output(List<Character> thelist) {
for (Character thing: thelist)
System.out.printf("%s ", thing);
System.out.println();
}
}
Is the List ArrayList or LinkedList??
I dare you to search xxx on Google Images with safe search off.
We can't count? It's you who can't count.
Can someone just give me a hint about this:
When i use the Enhanced for loop, WITH these >>> {}
my OUTPUT method shows everything like this:
p
w
n
But when i do the Enhanced for loop WITHOUT these >>> {}
it shows like this:
p w n
My question is, why these {} do this?? Its strange…
Are these list programs very useful?
Without declaring the visibility of a method, it would be default visibility, which is public. However, a good programmer should always declare a method as public or private. Private methods are appropriate for when they only need to be used in the same class. Using private methods to do each step of a more advanced method makes the program much more readable, both by the author and others.
If you don't want to add "static", that's fine. But you need to instantiate and object before you use it. something like bucky b = new bucky(); and b.print("test"); hopefully i answered you questions.
you can totally put "public " or nothing in front of it, it would just make other classes able to use that method. in this case, there's no other class that needs to use that method, so we put private(total up to you). This means there will be an error if other class try to instantiate the bucky.print() method.
And about static, if we don't need many different objects, we only need to functionality of that method, then we use "static", like the System.out.print method.
"static" means that you don't have to instantiate an new object when you want to use the method, you can use it directly. and private means that this method is only accessible within the class. the opposite is public, a public method can be called from outside the class.
anyone else missed the "that's what she said" at 2:49?
sometimes i have errors that i cant find out and i keep searching for a long time but it doesnt work i hate that
they dont look identical in my eclipse
Any one else notice that 1 and l in Eclipse look almost identical?
2:48 – that's what she said! 😉
I vote you for the geek king of the century! Keep up the good job dude! Cheers 🙂
I'm starting to think that you're misspelling words on purpose. hahaha!
Oh my god -_- I spent 15 minutes searching for my error and I had a semi colon after
for(Character xyz: thelist); <<– that 1.. pff 😛
System.out.printf("%s ", xyz);
the XD sign yours like xD lol 😀
hmmmmm…… very religious XD
His voice sounds wierd ….
Bucky I would just like to thank you for being the reason I passed my first Java semester xD.
Thanks Bucky. Yr awesome man. God bless you.
With the seperate method it is easier because you only have to make one for loop instead of typing in a printf() method multiple times (The explanation probably sucked but I hope it made a little bit of sense 🙂 )
UMMM
Thank you! you're better than my professor!
lsit is the new list
very nice tutorials man, ty for making them! cheers 🙂
Korean Rap? LOL
why write a new output method and not just use a printf() as in tut 10 ?
xxx
some are just skippers)
wut? I had fun 😀
anyone who is learning programming and at the start went oh wow didn't know 10 was before 11 just walk away now…
Is it just me or does it skip tut 10 on this playlist?
collections are boring 🙁
can't count…or can't look up…