From bfa38f6126fffa55f0c9dca95ac7e9e1b5754b45 Mon Sep 17 00:00:00 2001 From: Hannes Achleitner Date: Tue, 28 Nov 2023 09:42:01 +0100 Subject: [PATCH] Fix lint warning --- .../github/mikephil/charting/charts/PieChart.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/charts/PieChart.java b/MPChartLib/src/main/java/com/github/mikephil/charting/charts/PieChart.java index fd0c7a2839..f399909ded 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/charts/PieChart.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/charts/PieChart.java @@ -19,7 +19,6 @@ import com.github.mikephil.charting.utils.MPPointF; import com.github.mikephil.charting.utils.Utils; -import java.util.ArrayList; import java.util.List; import java.util.Locale; @@ -34,7 +33,7 @@ public class PieChart extends PieRadarChartBase { * rect object that represents the bounds of the piechart, needed for * drawing the circle */ - private RectF mCircleBox = new RectF(); + private final RectF mCircleBox = new RectF(); /** * flag indicating if entry labels should be drawn or not @@ -76,7 +75,7 @@ public class PieChart extends PieRadarChartBase { */ private CharSequence mCenterText = ""; - private MPPointF mCenterTextOffset = MPPointF.getInstance(0, 0); + private final MPPointF mCenterTextOffset = MPPointF.getInstance(0, 0); /** * indicates the size of the hole in the center of the piechart, default: @@ -304,10 +303,9 @@ public boolean needsHighlight(int index) { if (!valuesToHighlight()) return false; - for (int i = 0; i < mIndicesToHighlight.length; i++) - - // check if the xvalue for the given dataset needs highlight - if ((int) mIndicesToHighlight[i].getX() == index) + // check if the xvalue for the given dataset needs highlight + for (Highlight highlight : mIndicesToHighlight) + if ((int) highlight.getX() == index) return true; return false;