Skip to content
Advertisement

Tag: arraylist

How to remove the brackets [ ] from ArrayList#toString()?

I have created an Array List in Java that looks something like this: When I print errors I get it errors as [1,2,3,4,5,6,7,8,9] Now I want to remove the brackets([ ]) from this array list. I thought I could use the method errors.remove(“[“), but then I discovered that it is just boolean and displays a true or false. Could somebody

Adding null values to arraylist

Can I add null values to an ArrayList even if it has a generic type parameter? Eg. If so, will return 1 or 0? If I can add null values to an ArrayList, can I loop through only the indexes that contain items like this? Or would the for each loop also loop through the null values in the list?

How to sort dates of type string in java

I am building a android project where am storing some details which includes date as string,but now I need to sort the list view by date.I am bit confused on how to do it.I am done with everything but need to sort the list by date. Here is the overview of how am storing data. I have an arraylist of

Duplication on ArrayList Java

my title is bad but I don’t have an idea what it should be. My question is simple, I have four arraylist and I want to get similar words from two of them and put another arraylists. Anyway my array lists like; I tried this; But as you see arrList1 and arrList2 have duplicates so arrList4 will have same element

Getting values from one Array List using objects of another array list java

I have 3 ArrayLists. Students (ID, Name, Program) Courses (ID, Name, Credit Hours) StudentCourses (StudentId, CourseID) I am searching from StudentCourses by passing the StudentID and getting the courses registered with his/her name. My StudentCourse ArrayLIst has objects like this 49 (Student ID) CS233(Course ID) 49 (Student ID) CS231(Course ID) When a user searches for a student, say I’m searching

Advertisement