`
talentkep
  • 浏览: 100458 次
  • 性别: 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...

    Windows Mobile访问SQL Server CE 3.5.doc

    orderSet = new DeviceSQLDemo2.DBResultSets.OrdersResultSet(connString, ResultSetOptions.Scrollable | ResultSetOptions.Sensitive | ResultSetOptions.Updatable); } ``` 然后,我们可以通过BindingSource将...

    struts增删改查 查寻一个年份中的一个刊次记录

    String sql = "update WT_periodical_order set year_id=" + of.getYear_id() + ", order_title='" + of.getOrder_title() + "', order_number=" + of.getOrder_number() + ", order_cover='" + of.getOrder_cover...

    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 = ...

    hibernate_配置cascade_及all-delete-orphan.doc

    UPDATE ORDER SET CUSTOMER_ID = null WHERE ID = 2; ``` - 如果希望在解除关系的同时删除子实体,则需要显式地设置`cascade`属性为`all-delete-orphan`,并添加相应的配置: ```xml &lt;set name="orders" ...

    时间更新触发器

    SET s_order.userdef1 = GETDATE() FROM s_order, INSERTED I WHERE s_order.billid = I.billid; ``` 这段SQL代码展示了如何创建一个名为`TRIGGERNAME`的时间更新触发器,该触发器定义在名为`s_order`的表上。当对...

    Mysql中FIND_IN_SET()和IN区别简析

    在MySQL数据库中,`FIND_IN_SET()` 和 `IN` 是两种不同的查询方法,它们在处理数据集时有不同的特性和应用场景。本文将对这两种方法进行详细对比,以帮助理解它们之间的差异。 `FIND_IN_SET()` 函数主要用于在一个...

    Oracle触发器在税务MIS开发中的应用.pdf

    DELETE FROM order WHERE cu_no = :old.cu_no; END; ``` 这样的触发器在删除客户记录前,会检查并删除对应的订单,保证数据的一致性。 其次,对于数据冗余管理,当用户需要在数据模型中加入冗余数据以满足分析和...

    Oracle Trigger

    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; ``` 在这个示例中,当`customer`表中的数据被更新时,触发器会自动更新`order`...

    资深DBA对Oracle编写规范的总结

    WHERE ORDER_ID = p_order_id; -- 更新订单状态 UPDATE SALES_ORDER SET TOTAL_PRICE = v_total_price, STATUS = 'PROCESSED' WHERE ID = p_order_id; END; / ``` ##### 3.3 数据库代码接口管理 对于外部调用...

    119生成html精品购物商城

    7. **OrderSet.asp**:订单设置或创建页面,用户选择商品后在此页面确认购买信息,如数量、收货地址、支付方式等。 8. **TopPs.asp**:可能是顶部导航部分,显示品牌标识、导航菜单、搜索框等。 9. **TopTj.asp**...

    Oracle触发器在MIS开发中的应用分析

    update order set cu_no=:new.cu_no, cu_name=:new.cu_name, cu_address=:new.cu_address, where cu_no=:old.cu_no; end; ``` **3. 用触发器完成数据复制** 触发器也可以用于在不同的数据库之间同步数据。...

    Instruction Set Reference_intel 64

    - Instruction Set Reference A-M (Order Number 253666) - Instruction Set Reference N-Z (Order Number 253667) - System Programming Guide, Part 1 (Order Number 253668) - System Programming Guide, ...

    hibernate set 集合映射

    &lt;set name="orders" table="ORDER" inverse="true" lazy="true"&gt; &lt;one-to-many class="com.example.Order" /&gt; &lt;/set&gt; ``` 或者使用注解: ```java @Entity public class User { @OneToMany(mappedBy = "user...

    ASAP2Tool-Set_14.0_Manual_EN.pdf

    coded Addresses and Address Extensions)、默认事件(Default Events)、结构体(Structures)、元素属性覆盖(Overwrite Element ...引用(References to Structure Components)以及字节序(Byte Order)...

    支持Eclipse的deployment fileset插件

    - **组织filesets**:可以创建多个fileset,并通过“Order and Export”页签来设置它们的部署顺序和优先级。 5. **应用场景** - **多模块项目**:在一个大型的多模块Java项目中,每个模块可能有各自的依赖和资源...

    Spring Boot集成Mybatis中如何显示日志的实现

    @Update("UPDATE tb_order SET order_no = #{orderNo},amount = #{amount} WHERE id =#{id}") int update(Order order); } ``` 在上面的示例代码中,我们定义了一个 OrderMapper 接口,其中包含一个 update 方法...

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

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

Global site tag (gtag.js) - Google Analytics