Skip to main content

Posts

Showing posts with the label arraylist

Array lists and string splitting(Java) [closed]

I am trying to read a text file, and read its contends. Easy enough, right? But the files contents read: Part1:Part2 Part1:Part2 I am trying to add the string(s) to a to an array list, with the following protocol: Add "Part1" to an arraylist called p1, then add "Part2" to an arraylist called p2. I need to go through the whole text file with multiple lines. How would I do so?

arraylist java compiling errors

ok i try to play with arraylist in java awhile to experiment some thing that related my project..so i come up with a simple code like this having 3 file...DataStruc.java , DataStrucHand.java , testcase1.java DataStruc.java public class DataStruc { private String testString; public DataStruc(String s){ this.testString = s; } public String getTestString() { return testString; } public void setTestString(String testString) { this.testString = testString; } public String toString(){ return String.format("%s",testString); } } DataStrucHand.java import java.util.ArrayList; public class DataStrucHand { private ArrayList<DataStruc> ds; public void addData(String ss){ ds.add(new DataStruc(ss)); } public ArrayList<DataStruc> getData(){ return ds; } } testcase1.java import java.util.*; public class testcase1 { public static void main(String args []){ DataStrucHand dsh = new DataStrucHand(); String gdata = "test"; dsh.add

retrieve serialized java.util.Arraylist in asp.net client (SUID doesn"t match)

I am trying to send persisted objects from a java webservice to the ASP.Net client. Both sides have the object-classes, with the same SerialUID's. Classes without (Array)Lists pose no problem, but when I want to send objects including ArrayLists, the expected SUID is incorrect: [java.io.InvalidClassException] = {"the class does not match the class of the persisted object for cl = java.util.ArrayList : __SUID = 8683452581122892189, getSUID(cl) = 9195509126275115639"} Serialization is implemented using binary formatting, not XML because with XML we have circular references between the persisted objects. Using J# at client side, by expecting a java.util.ArrayList instead of an IList or a System.collections.ArrayList doesn't change anything. Any help would be greatly appreciated!