IT English Collection(27)of Collection

1 前言

  本文主要介绍了Foundation中的collection(集合类),以及他们之间的区别和各自的特点。

  转载请注明出处:http://blog.csdn.net/developer_zhang

2 详述

2.1 原文

  A collection is a Foundation framework object whoseprimary role is to store objects in the form of arrays, dictionaries, and sets.

Collection Classes


  The primary classes—NSArray, NSSet, and NSDictionary—share a number of features in common:

  They can hold only objects, but the objects can be of any type. An instance of NSArray, for example, could contain cats, dogs, or wombats, or anycombination of these.
  They maintain strong references to their contents.
  They are immutable, but have a mutable subclass that allows you to change the contents of the collection.
   You can iterate over their contents using NSEnumerator or fastenumeration.
Cocoa also provides three classes—NSPointerArray, NSHashTable, and NSMapTable—that aremodeled on these classes but that differ in the following ways:
·They may contain elements other than objects.
·They offer other memory management options.
·They are mutable.
  Since a Cocoa collection object can hold any sort of object (unlike collections in some other environments), you typically don’t create special collection classes to contain objects of aparticular type.

Ordering Schemes
  Collections store and vend other objects in a particular ordering scheme:
NSArray and its mutable subclass NSMutableArray use zero-based indexing.
In other environments, an array may be called a vector, table, or list.
  NSPointerArray is modeled after NSMutableArray, but it can also hold NULL values (which contribute to the object’s count). You can also set the count of the pointer array directly (something you can’t do in atraditional array).

  NSDictionary and its mutable subclass NSMutableDictionary use key-value pairs.
In other environments, a dictionary may be referred to as a hash table or hash map.

  NSMapTable is modeled after NSMutableDictionary but provides different options, in particular to support weak relationships in agarbage-collected environment.

  NSSet and its mutable subclass NSMutableSet provide unordered storage of objects.
Cocoa also provides NSCountedSet, which is a subclass of NSMutableSet and which keeps a count of how many times each object has been added to the set.


  NSHashTable is modeled after NSMutableSet but provides different options, mostly to support weak relationships in a garbage-collected environment.

2.2 生词

primary['praɪm(ə)rɪ]adj. 主要的;初级的;基本的

combination[kɒmbɪ'neɪʃ(ə)n]n. 结合;组合;联合;[化学] 化合

maintain[meɪn'teɪn; mən'teɪn]vt.维持;继续;维修

immutable[ɪ'mjuːtəb(ə)l]adj. 不变的;不可变的;不能变的

iterate['ɪtəreɪt]vt.迭代;重复

enumeration[ɪ,njuːmə'reɪʃən]n. 枚举;列举;[数] 计算;细目

modeled['mɔdld]v. 模仿(model的过去分词形式);模式化;被效仿

sort[sɔːt]n. 种类;方式;品质

particular[pə'tɪkjʊlə]adj. 特别的;详细的;独有的;挑剔的

schemes[skiːm]n. 方案,计划;阴谋(scheme的复数)

vend[vend]vt. 出售;公开发表

contribute[kən'trɪbjuːt; 'kɒntrɪbjuːt]vt.贡献,出力;投稿;捐献

traditional[trə'dɪʃ(ə)n(ə)l]adj.传统的;惯例的

garbage['gɑːbɪdʒ]n.垃圾;废物

storage['stɔːrɪdʒ]n. 存储;仓库;贮藏所

mostly['məʊs(t)lɪ]adv. 主要地;通常;多半地

3 结语

  以上是所有内容,希望对大家有所帮助。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值