`
talentkep
  • 浏览: 98557 次
  • 性别: Icon_minigender_1
  • 来自: 武汉
社区版块
存档分类
最新评论

order set

阅读更多
/*
 * $Id: OrderedMap.java,v 1.1 2009/04/28 06:38:23 E000315 Exp $
 *
 *  Copyright (c) 2001, 2002 The Open For Business Project - www.ofbiz.org
 *
 *  Permission is hereby granted, free of charge, to any person obtaining a
 *  copy of this software and associated documentation files (the "Software"),
 *  to deal in the Software without restriction, including without limitation
 *  the rights to use, copy, modify, merge, publish, distribute, sublicense,
 *  and/or sell copies of the Software, and to permit persons to whom the
 *  Software is furnished to do so, subject to the following conditions:
 *
 *  The above copyright notice and this permission notice shall be included
 *  in all copies or substantial portions of the Software.
 *
 *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 *  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 *  CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
 *  OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
 *  THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
package com.peter.apps.util;

import java.util.*;

/**
 * OrderedMap - HashMap backed by a linked list.
 *
 * @author     <a href="mailto:jaz@jflow.net">Andy Zeneski</a>
 * @version    $Revision: 1.1 $
 * @since      2.0
 */
public class OrderedMap extends HashMap {

    private List orderedKeys = new LinkedList();

    /**
     * @see java.util.Map#keySet()
     */   
    public Set keySet() {
        return new OrderedSet(orderedKeys);
    }
 
    /**
     * @see java.util.Map#put(java.lang.Object, java.lang.Object)
     */
    public Object put(Object key, Object value) {
        if (!orderedKeys.contains(key))
            orderedKeys.add(key);
        return super.put(key, value);
    }

    /**
     * @see java.util.Map#clear()
     */   
    public void clear() {
        super.clear();
        orderedKeys.clear();
    }
   
    /**
     * @see java.util.Map#remove(java.lang.Object)
     */
    public Object remove(Object key) {
        if (orderedKeys.contains(key))
            orderedKeys.remove(key);
        return super.remove(key);
    }
}

 

分享到:
评论

相关推荐

    吃货系统OrderingUtil.java

    OrderingSet orderset = new OrderingSet();// 创建订单对象 Scanner input = new Scanner(System.in); /** * 初始化订单信息 */ public void init() { orderset.names[0] = "张三"; orderset.addresses[0...

    java源代码公司管理系统

    import com.wsy.model.Order; import com.wsy.model.OrderAndBookInfo; import com.wsy.model.Reader; import com.wsy.model.user; public class Dao { protected static String dbClassName = ...

    重构—勿以善小而不为

    重构最大的敌人不是技巧与能力,而是懒惰,或者说是态度。许多细小的重构看似无足轻重,例如方法重命名、提取方法。即使重构了,似乎对代码的结构也没有太大的影响,于是就决定淡然处之...OrderSet分为WithDetails与Wi

    Generalized Set Order Relations and Scalarization in Set Optimization with Applications to Continuity and Robustness

    集优化问题中的广义集序关系和标量化及在连续性与鲁棒性中的应用,赵毅,陈纯荣,本文主要利用广义集序关系的线性和非线性标量化刻画,分别讨论了参数集优化问题的解连续性结果以及不确定多目标优化问题的鲁棒性�

    ordered-set:定义自定义迭代顺序的高性能 ES6 Set 子类

    有序集 ordered-set是一个高性能的 ES6 Set 子类,它允许控制迭代顺序。... // iterates in order defined by mySortingFunction } 安装 npm install ordered-set 用法 const OrderedSet = require

    Oracle Trigger

    本文介绍了oracle触发器的概念和类型,create or replace trigger bj_... update order set  cu_no=:new.cu_no,  cu_name=:new.cu_name,  cu_address=:new.cu_addess,  where cu_no=:old.cu_no;  end;

    解决Django响应JsonResponse返回json格式数据报错问题

    TYPEERROR: In order to allow non-dict objects to be serialized set the safe parmeter to False 解决: return JsonResponse({“name”: “tom”}, safe=False) 增加safe=false,使其接受列表 补充知识:...

    open-runtime-module-library:底物打开运行时模块库

    各种实用程序,包括OrderSet 。 实现MultiCurrency特性的Fungible令牌模块。 使用pallet-balances和orml-tokens模块提供MultiCurrency实施。 使链外数据在链上可用的Oracle模块。 实现Auction特征的拍卖模块。 ...

    64-ia-32-architectures instruction-set

    The Intel 64 and IA-32 Architectures ... Instruction Set Reference A-Z, Order Number 325383; System Programming Guide, Order Number 325384. Refer to all three volumes when evaluating your design needs.

    Intel® 64 and IA-32 Architectures Software Developer’

    Instruction Set Reference A-L, Order Number 253666; Instruction Set Reference M-U, Order Number 253667; Instruction Set Reference V-Z, Order Number 326018; Instruction Set Reference, Order Number ...

    小红书api封装sdk(JAVA)

    order.setStart_time(startTime.getTime()/1000+""); order.setEnd_time(endTime.getTime()/1000+""); order.setLogistics("red_auto"); order.setPage_no(pageNo); order.setPage_size(pageSize); request....

    Set Theory and Algebra in Computer Science

    sublanguage of first-order logic. Furthermore, other theories such as category theory and intuitionistic type theory have been proposed as alternatives to set theory to express all of mathematics.

    Python-KaggleInstacart市场篮子分析

    eval_set: which evaluation set this order belongs in (see SET described below) order_number: the order sequence number for this user (1 = first, n = nth) order_dow: the day of the week the order was...

    php.ini中的request_order推荐设置

    今天刚刚安装dede,安装完成由一条错误信息(PHP 5.3 and above) Please set ‘request_order’ ini value to include C,G and P (recommended: ‘CGP’) in php.ini dede中给出了解决的方法,把request_order这个...

    Netflix Prize 完整数据集

    In order to protect the privacy of customers, "some of the rating data for some customers in the training and qualifying sets have been deliberately perturbed in one or more of the following ways: ...

    Architecture Support for Task Out-of-Order Execution in MPSoCs

    In order to solve the problem, this paper proposes a novel high level architecture support for automatic out-of-order (OoO) task execution on FPGA based heterogeneous MPSoCs. The architecture support...

    Intel 64 and IA-32 Architectures Software Developer's Manual - Volume 2B - Instruction Set Reference, M-U - June 2016 (253667-059US)-计算机科学

    Instruction Set Reference A-L, Order Number 253666; Instruction Set Reference M-U, Order Number 253667; Instruction Set Reference V-Z, Order Number 326018; Instruction Set Reference, Order Number ...

    SORTSET (v2.0):根据用户定义的顺序对集合进行排序-matlab开发

    对于矩阵,SORTSET(S,ORDER) 对 S 的每一列进行排序,对于 ND 数组,SORTSET(S,ORDER) 沿 S 的第一个非单一维度对元素进行排序。 SORTSET(S,ORDER,DIM) 沿维度 DIM 排序。 [R, I, J] = SORTSET(S, ORDER) 返回索引...

    unordered_map和unordered_set的模拟实现

    unordered_map和unordered_set的模拟实现 (一)哈希表的特性及概念 定义: 哈希表(Hash table,也叫散列表),是根据关键字值(key,value)直接进行访问的数据结构。也就是说,它通过把关键字映射到表中一个位置来...

Global site tag (gtag.js) - Google Analytics