Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
312 views
in Technique[技术] by (71.8m points)

arrays - how can I Get Index Of The Shuffled Item After collections.shuffle if I shuffle the elements of the list?

arr=[2,3,1,1,4]
Collections.shuffle(arr)
println arr
firstElem= arr.first()
println firstElem

print:
[1,3,1,4,2]
1

I want to print position = 2

how can I print firstElem position? Please help

question from:https://stackoverflow.com/questions/65892292/how-can-i-get-index-of-the-shuffled-item-after-collections-shuffle-if-i-shuffle

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...