r/javahelp • • Jul 24 '20

Codeless New Java Features implemented by me

I saw a lot of people asking for a lot of features, so I thought, why not implement them? So I created a new project and I added some features a lot of you asked for. I implemented uint, BetterLists (I will talk about them later in this post) and a Testing class.

Basically the better lists are lists that have more methods. They can be reversed and some more features I forgot I added. BUT I added the feature that I saw everyone wanted. When you use the getValue(int index) method, you can pass a negative number. If the number you passed is negative, the list will take it from the end to the beginning. Check below.

BetterList<String> test = new BetterList<String>("1", "2", "3"); test.getValue(2); //will return "3" test.getValue(-2); //will return "2"

So this is what I created. I will give the code soon. Anybody who is interested or wants more features?

0 Upvotes

26 comments sorted by

View all comments

2

u/[deleted] Jul 24 '20

For everyone that needs explanation. I made a mistake in the post.

test.getValue(-2) will return 2.

0

u/-themailerdoraemon- Jul 24 '20

This means that your list now begins with index -1. Which is even more confusing. Stick to indices that begin with zero and increment by 1.

It works, and probably does not need any improving.

1

u/[deleted] Jul 24 '20

I already told you. You can access it with 0 or with -1 for that list. The only thing you should understand is that puting a minus before the number returns the result backwards. So yes, you can have the indexes 0 and -1 for the same item.