当前位置: 首页 > news >正文

深圳整站企业网络配置方案

深圳整站,企业网络配置方案,南昌旅游集团网站建设,wordpress需要php#x1f495;世事犹如书籍#xff0c;一页页被翻过去。人要向前看#xff0c;少翻历史旧账。#x1f495; 作者#xff1a;Mylvzi 文章主要内容#xff1a;数据结构之顺序表的模拟实现 /*** Created with IntelliJ IDEA.* Description:* User: 绿字* Date:…  世事犹如书籍一页页被翻过去。人要向前看少翻历史旧账。 作者Mylvzi   文章主要内容数据结构之顺序表的模拟实现    /*** Created with IntelliJ IDEA.* Description:* User: 绿字* Date: 2023-10-12* Time: 8:53*/ import java.util.*; /*** 顺序表详解*/ public class MyArrayList {private int[] elem;// 存放数据的数组private int usedSize;// 有效数据个数public static final int DEFAULT_SIZE 10;// 初始化顺序表public MyArrayList() {this.elem new int[DEFAULT_SIZE];}public MyArrayList(int ininCapacity) {// 自定义数组的大小this.elem new int[ininCapacity];}// 打印顺序表public void display() {for (int i 0; i this.usedSize ; i) {System.out.print(this.elem[i] );}}// 添加数据 默认是在末尾添加public void add(int data) {// 满了要扩容if(isFull()) {this.elem Arrays.copyOf(this.elem,2*this.elem.length);}this.elem[usedSize] data;this.usedSize;}// 判断是否已满public boolean isFull() {if(this.usedSize this.elem.length) {return true;}return false;}// 在 pos 位置新增元素public void add(int pos, int data) {// pos位置要合法if(pos0 || posthis.usedSize) {throw new RuntimeException(pos位置不合法);}if(isFull()) {this.elem Arrays.copyOf(this.elem,2*this.elem.length);}for (int i this.usedSize-1; i pos ; i--) {this.elem[i1] this.elem[i];}this.elem[pos] data;this.usedSize;}// 判定是否包含某个元素public boolean contains(int toFind) {for (int i 0; i this.usedSize ; i) {if(this.elem[i] toFind) {return true;}}System.out.println(数组不包含该元素);return false;}// 查找某个元素对应的位置public int indexOf(int toFind) {for (int i 0; i this.usedSize ; i) {if(this.elem[i] toFind) {return i;}}System.out.println(数组不包含该元素);return -1;}// 检查pos位置是否合法private void checkPosLegal(int pos) {if(pos0 || posthis.usedSize) {throw new posOutOfBoundException(pos 位置不合法);}}// 获取 pos 位置的元素public int get(int pos) {checkPosLegal(pos);return this.elem[pos];}// 给 pos 位置的元素设为 value pos位置必须含有元素public void set(int pos, int value) {checkPosLegal(pos);this.elem[pos] value;}//删除第一次出现的关键字keypublic void remove(int toRemove) {int index indexOf(toRemove);for (int i index; i this.usedSize-1 ; i) {this.elem[i] this.elem[i1];}this.usedSize--;}// 获取顺序表长度public int size() {return this.usedSize;}// 清空顺序表public void clear() {// 如果是引用类型所有的引用都要置空 // for (int i 0; i this.usedSize; i) { // this.elem[i] null; // }this.usedSize 0;} }/*** Created with IntelliJ IDEA.* Description:* User: 绿字* Date: 2023-10-12* Time: 10:49*/ public class posOutOfBoundException extends RuntimeException{public posOutOfBoundException() {}public posOutOfBoundException(String message) {super(message);} }/*** Created with IntelliJ IDEA.* Description:* User: 绿字* Date: 2023-10-12* Time: 9:02*/ public class Test1 {public static void main(String[] args) {MyArrayList myArrayList new MyArrayList(5);myArrayList.add(1);myArrayList.add(2);myArrayList.add(3);myArrayList.add(4); /* System.out.println(myArrayList.size());myArrayList.remove(1);System.out.println(myArrayList.size());*/ // myArrayList.add(100,99); /* myArrayList.set(0,999);myArrayList.remove(999);myArrayList.remove(2);myArrayList.remove(3);myArrayList.remove(4);myArrayList.remove(5);*//* System.out.println(myArrayList.get(0));System.out.println(myArrayList.get(-1));System.out.println(myArrayList.get(999));*/ // System.out.println(myArrayList.contains(2)); // System.out.println(myArrayList.indexOf(2)); // /* myArrayList.add(0,999);myArrayList.add(0,999);myArrayList.add(0,999);myArrayList.add(0,999);myArrayList.add(0,999);*/ myArrayList.clear();myArrayList.display();} }
http://wiki.neutronadmin.com/news/174112/

相关文章:

  • 成都建设局网站网站性能策划
  • asp网站安装c qq 互联网站开发代码
  • 资讯网站优化排名利用网络挣钱的路子
  • 网站建设作品2016 网站建设需求
  • 徐州百度网站快速优化海报在线设计生成器
  • 怎么提高网站建设水平成都做网站建设公司
  • ps做图 游戏下载网站有哪些内容网站不能粘贴怎么做
  • 深圳龙岗做网站的公司wordpress数据库连接错误
  • 温州网站建设价格技术做网站用什么语言高效
  • 中国最大的博客网站重庆万州网站建设费用
  • 专门做鞋子的网站吗晨阳seo
  • 哪些网站微信支付平台设计公司logo制作
  • cvv钓鱼网站怎么做优秀网站制作实例展示
  • 做的网站在百度找不到了网站建设主要推广方式
  • 苏州建网站制作费用多少钱聚名网域名转出
  • 湖南网站推广建设公司网络服务商电话
  • 用模板做的网站不好优化深圳网络营销技巧
  • 广州做网站的广州北京网站建设公司
  • 好网站设计公司淘宝指数查询工具
  • 济宁公司做网站北京百度网讯科技有限公司
  • 本地做网站顺序网站去版权
  • 聊城手机网站服务如何做一个网页设计方案
  • 服务好的武进网站建设沈阳网站制作公司云蓝图
  • 网站制作小常识找个人制作网页的网站
  • 从哪些方面进行网站建设网线制作实验报告总结
  • 龙岩市城乡建设局网站进不去网站设计制作推荐
  • 淄博培训网站建设seo引擎优化是什么
  • 新乡手机网站建设策划公司宣传语
  • 自己做网站的软件注册深圳公司条件
  • 网站建设与管理是哪个软件wp用户前端化专业版wordpress插件[中英双语]