java


I want to display the element in an arraylist, not the hashcode


I am currently trying to display a csv file called "Haha2" using csv open in Java. Unfortunately when I print the arraylist I get the hashcode and not the numbers that are contained in the file.
I have tried the .get() method and the .toArray() and .toString methods but I am still only able to print out the hashcode.
Here's my code:
import au.com.bytecode.opencsv.*;
import java.io.*;
import java.util.*;
public class playlist{
public static void main (String args()) throws IOException {
CSVReader reader = new CSVReader(new FileReader("Haha2.asc"),';', '"',29);
List <String[]> data = new ArrayList <String[]>();
data = reader.readAll();
System.out.println(data);
}
}
Here is a one-liner which first converts the list to an array giving you an array-of-arrays and then calling Arrays.deepToString().
System.out.println(Arrays.deepToString(data.toArray()));
Either loop through your list and call Arrays.toString() on each of the array of Strings, or transform List<String[]> into List<List<String>>.
Use Arrays.toString():
for( String[] array : data ) {
System.out.println(Arrays.toString(data));
}
iterate over the List and than over the array:
for( String[] array : data ) {
for( String string : array ) {
System.out.println(string);
}
System.out.println("---");
}
for (String[] arr : data) {
System.out.println(java.util.Arrays.asList(arr));
System.out.println("...");
}

Related Links

How can I overwrite a default table model?
How to setup game to be multiplayer? [closed]
Java - Recover bytes from string [duplicate]
Java compiler - several methods, same behaviour, different output [duplicate]
Cropping an image from URL to InputStream
IDs specified in Eclipse plugin
installing R package openNLP in R
Too many LOGS getting generated for Hystrix-AMQP
Logback: SizeAndTimeBasedRollingPolicy not honoring totalSizeCap
AnyLogic Agent-Based simulation agents value transfer
Java array accessing it from another class and using as a combobox
How to store 5 lines of data as 1 element in an ArrayList?
Android JSON Exception when parsing
Getting a random value from an array
How to print multiples of a given variable in java?
Synchronizing a Cipher

Categories

HOME
arduino-uno
testng
asp.net-core
vbscript
listview
netsuite
fme
getelementsbytagname
c#-2.0
binary-tree
directx
basic
gitpitch
dacpac
dosgi
ghc
ef-migrations
finite-automata
contextmenu
django-cms
swiftlint
dcevm
realex-payments-api
zurb-foundation-6
microsoft-r
blazemeter
qhull
bootstrap-duallistbox
info.plist
windows-server-2000
newline
google-rich-snippets
javascriptcore
exuberant-ctags
calibre
perlin-noise
commit
protovis
repo
force-layout
hexo
devextreme
space-complexity
swift3.0.2
android-fingerprint-api
ensembles
outlook-api
eclipse-gef
user-accounts
dotcover
apache-fop
pubmed
nstextview
np-complete
epson
query-performance
mediaelement
yt-project
rotativa
underscore.js-templating
mikroc
django-debug-toolbar
bstr
storekit
dlna
nessus
ptrace
netmq
r-tree
security-testing
microbenchmark
mmc
bridge.net
qpainter
asp.net-dynamic-data
has-many-through
reactfx
mechanize-ruby
jboss-weld
multiprocessor
floating-point-precision
ril
ember-app-kit
type-equivalence
browser-detection
dmoz
multipage
onsubmit
bubble-chart
netbeans-6.9
spring-portlet-mvc
subscript
mercurial-server
gdlib
android-sdk-2.1
datareader
sortable-tables
dentrix
gin
bespin
temporal-database
sector
misv

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App