Convert for loops to foreach loops (#592)

This commit is contained in:
Austin Shalit
2017-08-24 01:00:55 -04:00
committed by Peter Johnson
parent 848280d1f1
commit c45fb73f36
3 changed files with 6 additions and 6 deletions

View File

@@ -305,8 +305,8 @@ public class AnalogInput extends SensorBase implements PIDSource, LiveWindowSend
* @return The analog channel is attached to an accumulator. * @return The analog channel is attached to an accumulator.
*/ */
public boolean isAccumulatorChannel() { public boolean isAccumulatorChannel() {
for (int i = 0; i < kAccumulatorChannels.length; i++) { for (int channel : kAccumulatorChannels) {
if (m_channel == kAccumulatorChannels[i]) { if (m_channel == channel) {
return true; return true;
} }
} }

View File

@@ -324,8 +324,8 @@ public class Scheduler implements NamedSendable {
double[] toCancel = m_table.getNumberArray("Cancel", new double[0]); double[] toCancel = m_table.getNumberArray("Cancel", new double[0]);
if (toCancel.length > 0) { if (toCancel.length > 0) {
for (LinkedListElement e = m_firstCommand; e != null; e = e.getNext()) { for (LinkedListElement e = m_firstCommand; e != null; e = e.getNext()) {
for (int i = 0; i < toCancel.length; i++) { for (double d : toCancel) {
if (e.getData().hashCode() == toCancel[i]) { if (e.getData().hashCode() == d) {
e.getData().cancel(); e.getData().cancel();
} }
} }

View File

@@ -75,8 +75,8 @@ public class SortedVector<E> extends Vector<E> {
Object[] array = new Object[size()]; Object[] array = new Object[size()];
copyInto(array); copyInto(array);
removeAllElements(); removeAllElements();
for (int i = 0; i < array.length; i++) { for (Object o : array) {
addElement((E) array[i]); addElement((E) o);
} }
} }
} }