Topic: 如何模拟java数组的实现机制 |
Print this page |
1.如何模拟java数组的实现机制 | Copy to clipboard |
Posted by: yangjinfeng Posted on: 2005-01-19 21:10 老师叫我用模拟java数组的实现机制,我想了半天也查了很多资料,请教各位,如何模拟 |
2.Re:如何模拟java数组的实现机制 [Re: yangjinfeng] | Copy to clipboard |
Posted by: kavinwang Posted on: 2005-01-20 08:54 java 中有一个叫做ArrayList的类,你可以参考一下 |
3.Re:如何模拟java数组的实现机制 [Re: yangjinfeng] | Copy to clipboard |
Posted by: yangjinfeng Posted on: 2005-01-20 10:03 可是ArrayList本身就是用数组实现的呀,我的目的是要模拟java的实现机制,当然不能用数组本身了 |
4.Re:如何模拟java数组的实现机制 [Re: yangjinfeng] | Copy to clipboard |
Posted by: longyinggreat Posted on: 2005-01-20 13:28 那就是相当于你自己编一个类,实现ArrayList的全部功能就可以了 |
5.Re:如何模拟java数组的实现机制 [Re: yangjinfeng] | Copy to clipboard |
Posted by: yangjinfeng Posted on: 2005-01-20 14:04 如何实现?ArrayList是用数组实现的,我该如何实现呢,用链表吗?不行,因为既然是模拟数组,就得模拟实现顺序存储,大家没明白我的意思吗 |
6.Re:如何模拟java数组的实现机制 [Re: yangjinfeng] | Copy to clipboard |
Posted by: jigsaw Posted on: 2005-02-06 00:07 public class Pair { public Object key; public Object value; } i think we can implement any data structure w/ this Pair class. certainly u can hide these 2 fileds w/ setter/getter, u can add to it constructor other than default one, or u can use final fields to make it immutable. try it out. and let us know if u work it out. thx in advance. |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |