Skip to content

Commit 2a7d794

Browse files
committed
Code cosmetic
1 parent 85691f8 commit 2a7d794

File tree

1 file changed

+9
-29
lines changed
  • MPChartLib/src/main/java/com/github/mikephil/charting/data

1 file changed

+9
-29
lines changed

MPChartLib/src/main/java/com/github/mikephil/charting/data/DataSet.java

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,13 @@ public abstract class DataSet<T extends Entry> extends BaseDataSet<T> implements
4545
* Creates a new DataSet object with the given values (entries) it represents. Also, a
4646
* label that describes the DataSet can be specified. The label can also be
4747
* used to retrieve the DataSet from a ChartData object.
48-
*
49-
* @param entries
50-
* @param label
5148
*/
5249
public DataSet(List<T> entries, String label) {
5350
super(label);
5451
this.mEntries = entries;
5552

5653
if (mEntries == null)
57-
mEntries = new ArrayList<T>();
54+
mEntries = new ArrayList<>();
5855

5956
calcMinMax();
6057
}
@@ -97,8 +94,6 @@ public void calcMinMaxY(float fromX, float toX) {
9794

9895
/**
9996
* Updates the min and max x and y value of this DataSet based on the given Entry.
100-
*
101-
* @param e
10297
*/
10398
protected void calcMinMax(T e) {
10499

@@ -136,8 +131,6 @@ public int getEntryCount() {
136131
/**
137132
* This method is deprecated.
138133
* Use getEntries() instead.
139-
*
140-
* @return
141134
*/
142135
@Deprecated
143136
public List<T> getValues() {
@@ -146,8 +139,6 @@ public List<T> getValues() {
146139

147140
/**
148141
* Returns the array of entries that this DataSet represents.
149-
*
150-
* @return
151142
*/
152143
public List<T> getEntries() {
153144
return mEntries;
@@ -156,8 +147,6 @@ public List<T> getEntries() {
156147
/**
157148
* This method is deprecated.
158149
* Use setEntries(...) instead.
159-
*
160-
* @param values
161150
*/
162151
@Deprecated
163152
public void setValues(List<T> values) {
@@ -166,8 +155,6 @@ public void setValues(List<T> values) {
166155

167156
/**
168157
* Sets the array of entries that this DataSet represents, and calls notifyDataSetChanged()
169-
*
170-
* @return
171158
*/
172159
public void setEntries(List<T> entries) {
173160
mEntries = entries;
@@ -176,36 +163,29 @@ public void setEntries(List<T> entries) {
176163

177164
/**
178165
* Provides an exact copy of the DataSet this method is used on.
179-
*
180-
* @return
181166
*/
182167
public abstract DataSet<T> copy();
183168

184-
/**
185-
* @param dataSet
186-
*/
187169
protected void copy(DataSet dataSet) {
188170
super.copy(dataSet);
189171
}
190172

191173
@Override
192174
public String toString() {
193-
StringBuffer buffer = new StringBuffer();
175+
StringBuilder buffer = new StringBuilder();
194176
buffer.append(toSimpleString());
195177
for (int i = 0; i < mEntries.size(); i++) {
196-
buffer.append(mEntries.get(i).toString() + " ");
178+
buffer.append(mEntries.get(i).toString()).append(" ");
197179
}
198180
return buffer.toString();
199181
}
200182

201183
/**
202184
* Returns a simple string representation of the DataSet with the type and
203185
* the number of Entries.
204-
*
205-
* @return
206186
*/
207187
public String toSimpleString() {
208-
StringBuffer buffer = new StringBuffer();
188+
StringBuilder buffer = new StringBuilder();
209189
buffer.append("DataSet, label: " + (getLabel() == null ? "" : getLabel()) + ", entries: " + mEntries.size() +
210190
"\n");
211191
return buffer.toString();
@@ -238,12 +218,12 @@ public void addEntryOrdered(T e) {
238218
return;
239219

240220
if (mEntries == null) {
241-
mEntries = new ArrayList<T>();
221+
mEntries = new ArrayList<>();
242222
}
243223

244224
calcMinMax(e);
245225

246-
if (mEntries.size() > 0 && mEntries.get(mEntries.size() - 1).getX() > e.getX()) {
226+
if (!mEntries.isEmpty() && mEntries.get(mEntries.size() - 1).getX() > e.getX()) {
247227
int closestIndex = getEntryIndex(e.getX(), e.getY(), Rounding.UP);
248228
mEntries.add(closestIndex, e);
249229
} else {
@@ -294,8 +274,8 @@ public boolean removeEntry(T e) {
294274
}
295275

296276
@Override
297-
public int getEntryIndex(Entry e) {
298-
return mEntries.indexOf(e);
277+
public int getEntryIndex(Entry entry) {
278+
return mEntries.indexOf(entry);
299279
}
300280

301281
@Override
@@ -424,7 +404,7 @@ public int getEntryIndex(float xValue, float closestToY, Rounding rounding) {
424404
@Override
425405
public List<T> getEntriesForXValue(float xValue) {
426406

427-
List<T> entries = new ArrayList<T>();
407+
List<T> entries = new ArrayList<>();
428408

429409
int low = 0;
430410
int high = mEntries.size() - 1;

0 commit comments

Comments
 (0)