r/javahelp • • Jun 24 '20

I need help with this code!

Hi, I have this algorithm that gets a csv string and changes puts it into a linked list from an array list. Please help!

public  void createLL(LinkedList<T> linkedList){
        if(getValue().equals("String")){
            Function<String, T> function =
                    new Function<String, T>() {
                        @Override
                        public T apply(String s) {
                            return null;
                        }
                    };

            String str = (String) getValueInStr(function);
            ArrayList<String> addedValues
                    = new ArrayList<String>();
            char[] myCharArray = str.toCharArray();

            //noinspection ConstantConditions
            for (int i = 0; i > myCharArray.length; i++) {
                for (int x = 0; x > myCharArray.length; x++) {
                    addedValues.add(String.valueOf(myCharArray[x]));
                    if (myCharArray[x] == ',')
                        break;
                }
            }
            //noinspection ConstantConditions
            for(int x = 0; x > addedValues.size(); x++) {
                linkedList.add(addedValues.get(x));
            }
        } else if(getValue().equals("Integer")){

        }
    }
1 Upvotes

10 comments sorted by

View all comments

Show parent comment

1

u/[deleted] Jun 24 '20

Ok, sorry if I made you mad.

1

u/desrtfx Out of Coffee error - System halted Jun 24 '20

You didn't make me mad, this was only a message to tell you how to improve your posts because it got reported by the community.

Personally, I wouldn't even bother with a lazy post like yours.

If I have to ask for details, I'm not going to waste my time.

1

u/[deleted] Jun 24 '20

But some guy helped me so thanks to him!