harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yang Lang <yangl...@gmail.com>
Subject [imageio] return a String array
Date Sun, 28 Mar 2010 03:20:17 GMT
Hi guys,

When I am reading through ImageIO package’s source code, I found out there
are two difference way to return a String[].

For some methods, they call Arrays.clone() to clone a new string[] and
return the new one while some other methods returning the original String[]
directly.

e.g.:
1.
public String[] getFormatNames() {
    return names.clone();
}

2.
public String[] getImageReaderSpiNames() {
    return readerSpiNames;
}

I am wondering what the difference between these two usages is. For what
kind of situations I need to clone a new array ?

Thanks,

Lang

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message