JSONObject通过下标获取对应的值
Open
enhancement
- Dominant language
- Java
- Stars
- 4.4k
- Forks
- 613
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 6
Description
### 请描述您的需求或者改进建议
现在JSONObject是继承LinkedHashMap实现的,是有序的,我想通过下标来获取JSONObject中的值。
### 请描述你建议的实现方案
现在Map中的key是通过Set存储的,无法通过下标获取key,进而获得相应的值,我想在JSONObject类中增加ArrayList来维护Map的key,在增加或者删除值的时候,都来更新这个ArrayList,这样就很容易实现通过下标获取对应的值了,不知道是否可行。
### 描述您考虑过的替代方案
*对您考虑过的任何替代解决方案或功能的描述。*
#### 附加信息
*如果你还有其他需要提供的信息,可以在这里填写(可以提供截图、视频等)。*
Contributor guide
Research direction
Start by reading JSONObject and its LinkedHashMap-based storage and mutation paths. Confirm how indexed access should behave for insertion order, additions, removals, and invalid indexes; done means the requested value can be retrieved by position without breaking existing map behavior, with tests covering those cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100