@@ -257,15 +257,16 @@ void createAreas(final List<Pair<WalkPosition, Integer>> areasList) {
257257 // ----------------------------------------------------------------------
258258 // 1) size the matrix
259259 // ----------------------------------------------------------------------
260- private void initializeChokePointsMatrix (
261- final List < List < List < ChokePoint >>> chokePointsMatrix , final int areasCount ) {
260+ private void initializeChokePointsMatrix () {
261+ int areasCount = getAreaCount ();
262262 chokePointsMatrix .clear ();
263- for (int i = 0 ; i < areasCount + 1 ; ++i ) {
264- chokePointsMatrix .add (new ArrayList <>());
265- }
263+ // Unused due to ids starting at 1
264+ chokePointsMatrix .add (null );
266265 for (int id = 1 ; id <= areasCount ; ++id ) { // triangular matrix
266+ ArrayList <List <ChokePoint >> subList = new ArrayList <>();
267+ chokePointsMatrix .add (subList );
267268 for (int n = 0 ; n < id ; ++n ) {
268- chokePointsMatrix . get ( id ) .add (new ArrayList <>());
269+ subList .add (new ArrayList <>());
269270 }
270271 }
271272 }
@@ -332,7 +333,7 @@ public void createChokePoints(
332333 // }
333334
334335 // 1) size the matrix
335- initializeChokePointsMatrix (this . chokePointsMatrix , getAreaCount () );
336+ initializeChokePointsMatrix ();
336337
337338 // 2) Dispatch the global raw frontier between all the relevant pairs of areas:
338339 final java .util .Map <Pair <AreaId , AreaId >, List <WalkPosition >> rawFrontierByAreaPair =
0 commit comments