Hello, such a question, is there such a structure?

public static class Room{ public int id; public String name; public String title; public int seats; public int base_id; } Room[][] room = ... // инициализация 8х7 

How to find the index (x) room[3][x] at which for example base_id = 3 ? What are effective methods besides iterating over the entire array in a loop?

  • And the room [N] array is sorted by base_id? - s8am
  • No, the data is recorded in the usual way as it should be - Roma Kosyachenko
  • one
    How do you imagine searching for an element in such an array without searching? If you just call psychics. - temq
  • Maybe it's easier for you to use MapHash instead of an array, use base_id as a key. - Frozik6k
  • and how to fasten the structure in maphash? - Roma Kosyachenko

0