/*
* $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);
}
}
分享到:
相关推荐
OrderingSet orderset = new OrderingSet();// 创建订单对象 Scanner input = new Scanner(System.in); /** * 初始化订单信息 */ public void init() { orderset.names[0] = "张三"; orderset.addresses[0...
orderSet = new DeviceSQLDemo2.DBResultSets.OrdersResultSet(connString, ResultSetOptions.Scrollable | ResultSetOptions.Sensitive | ResultSetOptions.Updatable); } ``` 然后,我们可以通过BindingSource将...
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...
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 = ...
UPDATE ORDER SET CUSTOMER_ID = null WHERE ID = 2; ``` - 如果希望在解除关系的同时删除子实体,则需要显式地设置`cascade`属性为`all-delete-orphan`,并添加相应的配置: ```xml <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` 是两种不同的查询方法,它们在处理数据集时有不同的特性和应用场景。本文将对这两种方法进行详细对比,以帮助理解它们之间的差异。 `FIND_IN_SET()` 函数主要用于在一个...
DELETE FROM order WHERE cu_no = :old.cu_no; END; ``` 这样的触发器在删除客户记录前,会检查并删除对应的订单,保证数据的一致性。 其次,对于数据冗余管理,当用户需要在数据模型中加入冗余数据以满足分析和...
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`...
7. **OrderSet.asp**:订单设置或创建页面,用户选择商品后在此页面确认购买信息,如数量、收货地址、支付方式等。 8. **TopPs.asp**:可能是顶部导航部分,显示品牌标识、导航菜单、搜索框等。 9. **TopTj.asp**...
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 A-M (Order Number 253666) - Instruction Set Reference N-Z (Order Number 253667) - System Programming Guide, Part 1 (Order Number 253668) - System Programming Guide, ...
<set name="orders" table="ORDER" inverse="true" lazy="true"> <one-to-many class="com.example.Order" /> </set> ``` 或者使用注解: ```java @Entity public class User { @OneToMany(mappedBy = "user...
coded Addresses and Address Extensions)、默认事件(Default Events)、结构体(Structures)、元素属性覆盖(Overwrite Element ...引用(References to Structure Components)以及字节序(Byte Order)...
- **组织filesets**:可以创建多个fileset,并通过“Order and Export”页签来设置它们的部署顺序和优先级。 5. **应用场景** - **多模块项目**:在一个大型的多模块Java项目中,每个模块可能有各自的依赖和资源...
@Update("UPDATE tb_order SET order_no = #{orderNo},amount = #{amount} WHERE id =#{id}") int update(Order order); } ``` 在上面的示例代码中,我们定义了一个 OrderMapper 接口,其中包含一个 update 方法...
有序集 ordered-set是一个高性能的 ES6 Set 子类,它允许控制迭代顺序。... // iterates in order defined by mySortingFunction } 安装 npm install ordered-set 用法 const OrderedSet = require
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,使其接受列表 补充知识:...