Win a copy of Transfer Learning for Natural Language Processing (MEAP) this week in the Artificial Intelligence and Machine Learning forum!

Eleni Pap

+ Follow
since Dec 13, 2019
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Eleni Pap

I am not sure if my answer helps you. But I suggest you to debug, on the rest of the code, when your code doesn't run as you want.  
Right-click on the variable and add watches-to see in the right side all the values of the variable. Mark the specific lines on code for debug, to see the result on debug!

8 hours ago
I would like to write on a new file the content of a list.

My list consists of rows and columns.
I get new the file such as:

[aaa, BBB, ]
[ccc,  Eee,]

But I prefer to show the content of the list without [] and ,
More specifically:

I cannot understand why I get the data int this way. May it returns the list such as  the output in console. So, it may doesn't return each content but all the arraylist  ???

1 day ago
Thank you. I have change it in this way
  writer.write(Arrays.toString(str) +"\t"+ System.lineSeparator());
  writer.write(Arrays.toString(str) +"\t"+ "\n");

I get values with tab and new lines, but also my output has a comma.Could I delete it?
Is there any way to delete the comma?
1 day ago
I use this code in order to save the content of ArrayList in file

My list declaration:
Link<String[]> list=new Arraylist<>();

I would like to separate the values with a tab instead comma, is this possible?

Thank you in advance!
1 day ago
Thank you!!! It really helps me !!
1 day ago
Having a List<String[]> arr= new Arraylist -> Could I get the number of rows and columns?

I found via searching on google the:
for column, but it doesn't work. (error)

My approach is:
for ( ir = 0; ir < array.size(); ir++) {
               for (ic = 0; ic < array.get(ir).length; ic++)

Thank you in advance
1 day ago
Thanks all for your directions.

I realized that my code runs OK. But I cannot understand it.

I tried to get a field on ArrayList in this way //System.out.println(temps.get(3)[1]);
and program return the value that I want.

It confuses me the program, when appear the fields with a comma. I thought that I have one String for each line. But if I had one String , comma won't be on my ArrayList but only a blank field.
I mean [ELENI PAP] and not [ELENI, PAP]

On debug, I noticed only the
line = FNAME\t LNAME\t   \tPHONE and not the
values, which are all the fields  0\FIRSTNAME 1\LASTNAME ETC.

So, I try with a delimiter, with split, with ArrayList, LinkedList in order to manage, what I have already done.


nextLine(): It reads until to find the character ā€˜\nā€™
next(): it reads until to find next String

Thanks a lot all of you for your time.

3 days ago
When I use next instead nextLine, I get the first line of my text file, as many fields of an array. For example:
[FirstName] [LastName]

But it gets only the first line, I try to get all the text in 2D array.
When I use nextLine than next I get the first line as one field.
[FirstName, LastName]

Now it reads only the first line of my text file(sc.nextLine) or only the first column(
It does not read all the content of my file.
4 days ago

Nothing it works.
Thank you again!!!

values: [FNAME, LNAME,  PHONE]
temps to String[[Ljava.lang.String;@1a6c5a9e, [Ljava.lang.String;@37bba400, [Ljava.lang.String;@179d3b25, [Ljava.lang.String;@20ad9418]
temps to Array[Ljava.lang.Object;@31cefde0
temps as List[[[Ljava.lang.String;@1a6c5a9e, [Ljava.lang.String;@37bba400, [Ljava.lang.String;@179d3b25...]]
4 days ago
Thank you for your time. My code has parenthesis.
So, I will try later, to complete it and show the answer!

Thanks for your help!!
5 days ago
Yes, but it prints:

[Column1, Row1]
[Column1, Row1, Row2]

It doesn't create the
[column1] [column2] [column3]
[row1] [ro2] [row3]


[[[Ljava.lang.String;@45656@26c, [Ljava.lang.String;@15689@41c]]
[[[Ljava.lang.String;@45656@26c, [Ljava.lang.String;@15689@41c, [Ljava.lang.String;@5197848c]]
[[[Ljava.lang.String;@45656@26c, [Ljava.lang.String;@1568c941, [Ljava.lang.String;@5197848c, [Ljava.lang.String;@17f052a3]]

I mean that I waited at least something like
[Ljava.lang.String;@4565@626c] [Ljava.lang.String;@4565@626c] [Ljava.lang.String;@4565@626c]
[Ljava.lang.String;@4565@626c] [Ljava.lang.String;@4565@626c] [Ljava.lang.String;@4565@626c]
6 days ago
I remove it to understand better the steps.

This create:
[column1, column2, .., ...]

And this:

This create this:
[[Ljava.lang.String;@238e0d81, [Ljava.lang.String;@5489eee81]

6 days ago
This is another way to store the data . But on debug, I don't see  array[][] but an array[]

6 days ago
I really appreciate your help and thanks for your time.

In this way, I can see the file as I want. But I don't store the data on ArrayList.
When I try to save the data on ArrayList, I get either an array as a column with all values or an array as a row.

6 days ago