Miroslav Lehotsky wrote:
...This is what I wrote based on your original comment...
The code there was just simplified pseudocode. You just copied reference to the same list... You need to make really a separate list object (eg. List<?> listCopy = new ArrayList<>(list);) And regarding second scenario, see post above, it's not safe operation performed like that, it can work for you, but it's undefined behavior when adding list to itself... So in that case you should go with the copies as well...
Miroslav Lehotsky wrote:Actually, for second scenario it could be even better, by not using copy of the original list at all, and just append by addAll to the originalList same originalList, eg: originalList.addAll(originalList).
Daniel Demesmaecker wrote:
I would remove the actionlistener on the textfield en move it's code to the actionlistener of the button.
My guess is you use the button and the actionlistener on the textfield isn't being called.
Daniel Demesmaecker wrote:The parsing you did right, are you able to start your program and to fill in a number? I'm not so familiar with swing, I always use javafx
Daniel Demesmaecker wrote:And I haven't really red your code, put if you expecting an int you have to parse it, cause it will return a string.
Dave Tolls wrote:
Can you explain what the above code is doing and when you expect it to run?
Norm Radder wrote:
it claims not not receive any numbers.
How is that reported?
If there are any error messages, copy the full text and paste it here.