1

i want ArrayList forEach in {N}

how to? help us! plz.

Code for Java

public boolean OnPressEvent(ArrayList<MarkerItem> markers){
// in code
}

Code for {N}

onPressEvent: function(markers: MarkerItem[]) {
// in code (for android)
console.log("length", markers.length) // = undefined
console.log("length", markers.size()) // = 0~n (integer)

// i want run below codes.
markers.forEach(function(marker){
// marker editing....
});
}

1 Answer 1

4

The easiest way is:

onPressEvent: function(markers: MarkerItem[]) {
  var size = markers.size();
  for (var i=0;i<size;i++) {
    var aMarker = markers.get(i);
    // Do whatever I need to do with this item
  }
});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.