Due to the wide spread of this article “I am a thread”, many added my QQ and wechat, exchange programming learning problems.
But I have found that many of them, especially beginners, have encountered a very common situation: that is, they only learned Java syntax, but did not learn programming.
As an example, here is a SimpleList class that mimics Java’s ArrayList. It has a defined interface that needs to be implemented:
/ * *
* A custom class that mimics ArrayList, where you implement add, get, remove, etc
* @ the author liu xin
public class SimpleList{
private Object[] elementData;
private int size=0;
public int size() {
return -1;
public SimpleList(){
public boolean isEmpty() {
return false;
public boolean add(T e) {
return false;
public boolean remove(Object o) {
return false;
public T get(int index) {
return null;
Then I tested this class on several people, and I found that very few people could successfully implement these methods, even the very crude implementation.
If you are interested, you can try it in your language.
This topic does not require the implementation of complex algorithms, nor does it require object-oriented design, nor does it require the consideration of thread safety in multithreading.
Use an Object array.
If there is a syntactic difficulty, it is the use of generics.
In fact, if I take away generics, I don’t think they can be implemented, because the core logic of this class is not generics.
All this SimpleList requires is the ability to manipulate an array.
1. Can add data to array, record size, if the array space is insufficient, need to increase the space
2. Delete the specified position of the array, and move the following data forward.
Difficult? This is the basic quality of programming, the essence of programming, and it doesn’t matter what language you use.
If I had learned C# or Python instead of Java, I would have gotten the same result.
I think that many people lack the most basic training in data structures and algorithms, and have not developed the way of logical thinking oriented to computers.
In fact, the solution is very simple: more practice and more coding. I recommend doing more exercises on data institutions and algorithms, which is also my personal experience. When I was in college, I did all the exercises on data structures.
If you want to choose code farming as a career in the future, this programming ability is essential, so students in school, might as well start now, the lack of ability.
“Code farmers turn“Public account: Created by a former IBM architect who worked for 15 years to share lessons learned in programming and the workplace.
Long press the QR code to followCode farmers turn