---------------------- android培训、java培训、期待与您交流! ----------------------
String className = props.getProperty("classMame");
Collection collections = (Collection)Class.forName(className).newInstance();//运用config配置文件和反射进行实例collection
// Collection collections = new HashSet() ;
ReflectPoint pt1 = new ReflectPoint(3,3);
ReflectPoint pt2 = new ReflectPoint(3,5);
ReflectPoint pt3 = new ReflectPoint(3,3);
collections.add(pt1);
collections.add(pt2);
collections.add(pt3);
pt1.y = 7;//使用HashSet(与hash值相关的类)时,在保存后不能修改参与hash值计算的参数,不然会导致对象不能删除,造成内存泄漏!
collections.remove(pt1);
System.out.println(collections.size());
这里打印出来的长度还是3;因为在删除对象前,修改了参与哈希值计算的属性值,导致jvm没有找到pt1对象的哈希值从而没有删除pt1对象!!
package HEIMA_refelct;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Collection;
import java.util.HashSet;
import java.util.Properties;
public class ReflectTest1 {
public static void main(String args[]) throws Exception{
InputStream ips = new FileInputStream("config.properties");//[读取配置文件需根据文件路径输入相应路径(前面的写法是当config与工程平级)]
// InputStream ips = ReflectTest1.class.getResourceAsStream("resource/config.properties");//运用字节码的方法取得输入流
Properties props = new Properties();
props.load(ips);
ips.close();
String className = props.getProperty("classMame");
Collection collections = (Collection)Class.forName(className).newInstance();//运用config配置文件和反射进行实例collection
// Collection collections = new HashSet() ;
ReflectPoint pt1 = new ReflectPoint(3,3);
ReflectPoint pt2 = new ReflectPoint(3,5);
ReflectPoint pt3 = new ReflectPoint(3,3);
collections.add(pt1);
collections.add(pt2);
collections.add(pt3);
pt1.y = 7;//使用HashSet(与hash值相关的类)时,在保存后不能修改参与hash值计算的参数,不然会导致对象不能删除,造成内存泄漏!
collections.remove(pt1);
System.out.println(collections.size());
}
}
---------------------- android培训、java培训、期待与您交流! ----------------------
详细请查看:http://edu.csdn.net/heima
分享到:
相关推荐
赠送jar包:shiro-crypto-hash-1.4.0.jar; 赠送原API文档:shiro-crypto-hash-1.4.0-javadoc.jar; 赠送源代码:shiro-crypto-hash-1.4.0-sources.jar; 赠送Maven依赖信息文件:shiro-crypto-hash-1.4.0.pom; ...
Hash-Hash-Hash
赠送jar包:shiro-crypto-hash-1.4.0.jar; 赠送原API文档:shiro-crypto-hash-1.4.0-javadoc.jar; 赠送源代码:shiro-crypto-hash-1.4.0-sources.jar; 赠送Maven依赖信息文件:shiro-crypto-hash-1.4.0.pom; ...
python_geohash-0.8.5-cp39-cp39-win_amd64
python_geohash-0.8.5-cp37-cp37m-win_amd64
python_geohash-0.8.5-cp36-cp36m-win32
python_geohash-0.8.5-cp35-cp35m-win_amd64
Jemter测试MQ的插件 JMeter-Rabbit-AMQP在github上17年便停止更新了,不支持rabbitmq的交换机类型“x-consistent-hash”,为此我更改了源码使其支持"x-consistent-hash
基于java的开发源码-哈希计算工具 Java-hash.zip 基于java的开发源码-哈希计算工具 Java-hash.zip 基于java的开发源码-哈希计算工具 Java-hash.zip 基于java的开发源码-哈希计算工具 Java-hash.zip 基于java的开发...
hashcat-6.1.1 hashcat-6.1.1 hashcat-6.1.1hashcat-6.1.1hashcat-6.1.1hashcat-6.1.1
文档描述了Windows下LM HASH ,NTLM HASH生成原理和规则。 并利用Python脚本进行模拟。 详细描述了 挑战/响应模式(鉴权协议)的原理 详细描述了NTLM SMB通信流程 对内网渗透入门感兴趣的一定下载
安装与npm npm install webpack-plugin-hash-output --save-dev带纱yarn add webpack-plugin-hash-output --dev为什么? 还有其他的webpack插件可以在那里散列。 但是,当它们运行时,它们不会“看到”代码的最终...
内容描述:用于crypto中hash爆破的强大工具。 优势:相较于其他hash工具,具有更快的算力,使用方便简洁。 适用:适用于md5,sha256等典型hash加密方式,反推出所需的源码。
hashcat-utils Hashcat-utils are a set of small utilities that are useful in advanced password cracking Brief description They all are packed into multiple stand-alone binaries. All of these utils ...
前端开源库-copy-webpack-plugin-hash复制Webpack插件哈希,使用Webpack复制文件和目录
python_geohash-0.8.5-cp37-cp37m-win32
hashcat + john-1.9.0-jumbo-1-win64, 哈希运算,破解工具
Geohash-1.0-py2.7 python计算geohash值转换为经纬度
关于hash攻击的国外最新技术,主要是针对域环境下的攻击手段,相信你懂得!