ArrayDeque in Java[通俗易懂]

ArrayDeque in Java[通俗易懂]ArrayDequeinJavaArrayDequeinJavaprovidesawaytoapplyresizable-arrayinadditiontotheimplementationoftheDequeinterface.ItisalsoknownasArrayDoubleEndedQueueorArrayDeck.Thi…

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE使用 1年只要46元 售后保障 童叟无欺

ArrayDeque in Java

ArrayDeque in Java provides a way to apply resizable-array in addition to the implementation of the Deque interface. It is also known as Array Double Ended Queue or Array Deck. This is a special kind of array that grows and allows users to add or remove an element from both the sides of the queue. Few important features of ArrayDeque are as follows:

  • Array deques have no capacity restrictions and they grow as necessary to support usage.
  • They are not thread-safe which means that in the absence of external synchronization, ArrayDeque does not support concurrent access by multiple threads.
  • Null elements are prohibited in the ArrayDeque.
  • ArrayDeque class is likely to be faster than Stack when used as a stack.
  • ArrayDeque class is likely to be faster than LinkedList when used as a queue.

Declaration:

public class ArrayDeque Element
   extends AbstractCollection
   implements DequeElement, Cloneable, Serializable

Here, Element refers to the element which can refer to any class, such as Integer or Stringclass.

Constructors in ArrayDeque:

  1. ArrayDeque(): Used to create an empty ArrayDeque and by default holds an initial capacity to hold 16 elements.
  2. ArrayDeque(Collection c): Used to create an ArrayDeque containing all the elements same as that of the specified collection.
  3. ArrayDeque(int numofElements): Used to create an empty ArrayDeque wand holds the capacity to contain a specified number of elements.

Example:

// Java program to demonstrate few functions of 
// ArrayDeque in Java 

import java.util.*; 
public class ArrayDequeDemo 
{ 
	public static void main(String[] args) 
	{ 
		// Intializing an deque 
		Deque<Integer> de_que = new ArrayDeque<Integer>(10); 

		// add() method to insert 
		de_que.add(10); 
		de_que.add(20); 
		de_que.add(30); 
		de_que.add(40); 
		de_que.add(50); 
		for (Integer element : de_que) 
		{ 
			System.out.println("Element : " + element); 
		} 

		System.out.println("Using clear() "); 

		// clear() method 
		de_que.clear(); 

		// addFirst() method to insert at start 
		de_que.addFirst(564); 
		de_que.addFirst(291); 

		// addLast() method to insert at end 
		de_que.addLast(24); 
		de_que.addLast(14); 

		System.out.println("Above elements are removed now"); 

		// Iterator() : 
		System.out.println("Elements of deque using Iterator :"); 
		for(Iterator itr = de_que.iterator(); itr.hasNext();) 
		{ 
			System.out.println(itr.next()); 
		} 

		// descendingIterator() : to reverse the deque order 
		System.out.println("Elements of deque in reverse order :"); 
		for(Iterator dItr = de_que.descendingIterator(); 
											dItr.hasNext();) 
		{ 
			System.out.println(dItr.next()); 
		} 

		// element() method : to get Head element 
		System.out.println("\nHead Element using element(): " + 
											de_que.element()); 

		// getFirst() method : to get Head element 
		System.out.println("Head Element using getFirst(): " + 
											de_que.getFirst()); 

		// getLast() method : to get last element 
		System.out.println("Last Element using getLast(): " + 
												de_que.getLast()); 

		// toArray() method : 
		Object[] arr = de_que.toArray(); 
		System.out.println("\nArray Size : " + arr.length); 

		System.out.print("Array elements : "); 
		for(int i=0; i<arr.length ; i++) 
			System.out.print(" " + arr[i]); 
			
		// peek() method : to get head 
		System.out.println("\nHead element : " + de_que.peek()); 
		
		// poll() method : to get head 
		System.out.println("Head element poll : " + de_que.poll()); 
		
		// push() method : 
		de_que.push(265); 
		de_que.push(984); 
		de_que.push(2365); 
		
		// remove() method : to get head 
		System.out.println("Head element remove : " + de_que.remove()); 
		
		System.out.println("The final array is: "+de_que); 
	} 
} 

Output:

Element : 10
Element : 20
Element : 30
Element : 40
Element : 50
Using clear() 
Above elements are removed now
Elements of deque using Iterator :
291
564
24
14
Elements of deque in reverse order :
14
24
564
291

Head Element using element(): 291
Head Element using getFirst(): 291
Last Element using getLast(): 14

Array Size : 4
Array elements :  291 564 24 14
Head element : 291
Head element poll : 291
Head element remove : 2365
The final array is: [984, 265, 564, 24, 14]

Methods in ArrayDeque:

  1. add(Element e) : The method inserts particular element at the end of the deque.
  2. addFirst(Element e) : The method inserts particular element at the start of the deque.
  3. addLast(Element e) : The method inserts particular element at the end of the deque. It is similiar to add() method
  4. clear() : The method removes all deque elements.
  5. size() : The method returns the no. of elements in deque.
  6. clone() : The method copies the deque.
  7. contains(Obj) : The method checks whether a deque contains the element or not
  8. Iterator() : The method returns an iterator over the deque.
  9. descendingIterator() : The method returns a reverse order iterator over the deque
  10. element() : The method returns element at the head of the deque
  11. getFirst(): The method returns first element of the deque
  12. getLast(): The method returns last element of the deque
  13. isEmpty(): The method checks whether the deque is empty or not.
  14. toArray(): The method returns array having the elements of deque.
  15. offer(Element e) : The method inserts element at the end of deque.
  16. offerFirst(Element e) : The method inserts element at the front of deque.
  17. offerLast(Element e) : The method inserts element at the end of deque.
  18. peek() : The method returns head element without removing it.
  19. peekFirst() : The method returns first element without removing it.
  20. peekLast() : The method returns last element without removing it.
  21. poll() : The method returns head element and also removes it
  22. pollFirst() : The method returns first element and also removes it
  23. pollLast() : The method returns last element and also removes it
  24. pop() : The method pops out an element for stack repesented by deque
  25. push(Element e) : The method pushes an element onto stack repesented by deque
  26. remove() : The method returns head element and also removes it
  27. removeFirst() : The method returns first element and also removes it
  28. removeLast() : The method returns last element and also removes it
  29. removeFirstOccurrence(Obj) : The method removes the element where it first occur in the deque.
  30. removeLastOccurrence(Obj) : The method removes the element where it last occur in the deque.

ArrayDeque addFirst() Method in Java

The java.util.ArrayDeque.addFirst(Object element) method in Java is used to insert a specific element at the front of this deque.

Syntax:

Array_Deque.addFirst(Object element)

Parameters: The parameter element is of the type ArrayDeque and refers to the element to be added.

Return Value: The function does not return any value.

Exceptions: The method throws NullPointerException if the passed parameter is NULL.

Below programs illustrate the Java.util.ArrayDeque.addFirst() method:
Program 1:

// Java code to illustrate addFirst() 
import java.util.*; 

public class ArrayDequeDemo { 
	public static void main(String args[]) 
	{ 
		// Creating an empty ArrayDeque 
		Deque<Integer> de_que = new ArrayDeque<Integer>(); 

		// Use add() method to add elements into the Deque 
		de_que.add(10); 
		de_que.add(15); 
		de_que.add(30); 
		de_que.add(20); 
		de_que.add(5); 

		// Displaying the ArrayDeque 
		System.out.println("ArrayDeque: " + de_que); 

		// Adding elements at front 
		de_que.addFirst(40); 
		de_que.addFirst(50); 
		de_que.addFirst(60); 
		de_que.addFirst(70); 

		// Displaying the ArrayDeque 
		System.out.println("ArrayDeque_front_addition: " + de_que); 

		// Adding elements using add() 
		de_que.add(1); 
		de_que.add(2); 
		de_que.add(3); 

		// Displaying the final ArrayDeque 
		System.out.println("Final ArrayDeque: " + de_que); 
	} 
} 

Output:

ArrayDeque: [10, 15, 30, 20, 5]
ArrayDeque_front_addition: [70, 60, 50, 40, 10, 15, 30, 20, 5]
Final ArrayDeque: [70, 60, 50, 40, 10, 15, 30, 20, 5, 1, 2, 3]

ArrayDeque add() Method in Java

The Java.util.ArrayDeque.add(Object element) method in Java is used to add a specific element at the end of the Deque. The function is similar to the addLast() method of ArrayDeque in Java.

Syntax:

Array_Deque.add(Object element)

Parameters: The parameter element is of the type ArrayDeque and refers to the element to be added to the Deque.

Return Value: The function returns True if the element is successfully added into the deque else it returns false.

Exceptions: The method throws NullPointerException if the passed parameter is NULL.

Below programs illustrate the Java.util.ArrayDeque.add() method:
Program 1: Adding String elements into the Deque.

// Java code to illustrate add() 
import java.util.*; 

public class ArrayDequeDemo { 
	public static void main(String args[]) 
	{ 
		// Creating an empty ArrayDeque 
		Deque<String> de_que = new ArrayDeque<String>(); 

		// Use add() method to add elements into the Deque 
		de_que.add("Welcome"); 
		de_que.add("To"); 
		de_que.add("Geeks"); 
		de_que.add("4"); 
		de_que.add("Geeks"); 

		// Displaying the ArrayDeque 
		System.out.println("ArrayDeque: " + de_que); 
	} 
} 

Output:

ArrayDeque: [Welcome, To, Geeks, 4, Geeks]

Program 2: Adding Integer elements into the Deque.

// Java code to illustrate add() 
import java.util.*; 

public class ArrayDequeDemo { 
	public static void main(String args[]) 
	{ 
		// Creating an empty ArrayDeque 
		Deque<Integer> de_que = new ArrayDeque<Integer>(); 

		// Use add() method to add elements into the Deque 
		de_que.add(10); 
		de_que.add(15); 
		de_que.add(30); 
		de_que.add(20); 
		de_que.add(5); 

		// Displaying the ArrayDeque 
		System.out.println("ArrayDeque: " + de_que); 
	} 
} 

Output:

ArrayDeque: [10, 15, 30, 20, 5]

ArrayDeque addLast() Method in Java

The java.util.ArrayDeque.addLast(Object element) method in Java is used to insert a specific element at the end of this deque. It is similar to the add() method in Java.

Syntax:

Array_Deque.addLast(Object element)

Parameters: The parameter element is of the type ArrayDeque and refers to the element to be added.

Return Value: The function does not return any value.

Exceptions: The method throws NullPointerException if the passed parameter is NULL.

Below programs illustrate the Java.util.ArrayDeque.addLast() method:
Program 1: Adding Integers to the Deque.

// Java code to illustrate addLast() 
import java.util.*; 

public class ArrayDequeDemo { 
	public static void main(String args[]) 
	{ 
		// Creating an empty ArrayDeque 
		Deque<Integer> de_que = new ArrayDeque<Integer>(); 

		// Use add() method to add elements into the Deque 
		de_que.add(10); 
		de_que.add(15); 
		de_que.add(30); 
		de_que.add(20); 
		de_que.add(5); 

		// Displaying the ArrayDeque 
		System.out.println("ArrayDeque: " + de_que); 

		// Adding elements at the end 
		de_que.addLast(40); 
		de_que.addLast(50); 
		de_que.addLast(60); 
		de_que.addLast(70); 

		// Displaying the ArrayDeque 
		System.out.println("ArrayDeque_end_addition: " + de_que); 
	} 
} 

Output:

ArrayDeque: [10, 15, 30, 20, 5]
ArrayDeque_end_addition: [10, 15, 30, 20, 5, 40, 50, 60, 70]

ArrayDeque getFirst() Method in Java

The java.util.ArrayDeque.getFirst() method in Java is used to retrieve or fetch the first element of the ArrayDeque. In the process, the method does not delete the element from the deque instead it just returns the first element of the deque.

Syntax:

Array_Deque.getFirst()

Parameters: The method does not take any parameter.

Return Value: The method returns the first element present in the Deque.

Below programs illustrate the Java.util.ArrayDeque.getFirst() method:

Program 1:

// Java code to illustrate getFirst() 
import java.util.*; 

public class ArrayDequeDemo { 
	public static void main(String args[]) 
	{ 
		// Creating an empty ArrayDeque 
		ArrayDeque<String> de_que = new ArrayDeque<String>(); 

		// Use add() method to add elements into the Deque 
		de_que.add("Welcome"); 
		de_que.add("To"); 
		de_que.add("Geeks"); 
		de_que.add("4"); 
		de_que.add("Geeks"); 

		// Displaying the ArrayDeque 
		System.out.println("ArrayDeque: " + de_que); 

		// Displaying the first element 
		System.out.println("The first element is: " + 
									de_que.getFirst()); 
	} 
} 

Output:

ArrayDeque: [Welcome, To, Geeks, 4, Geeks]
The first element is: Welcome

ArrayDeque isEmpty() Method in Java

The Java.util.ArrayDeque.isEmpty() method in Java is used to check and verify if an ArrayDeque is empty or not. It returns True if the Deque is empty else it returns False.

Syntax:

Array_Deque.isEmpty()

Parameters: The method does not take any parameter.

Return Value: The function returns True if the deque is empty else it returns False.

Below programs illustrate the Java.util.ArrayDeque.isEmpty() method:

Program 1:

// Java code to illustrate isEmpty() 
import java.util.*; 

public class ArrayDequeDemo { 
	public static void main(String args[]) 
	{ 
		// Creating an empty ArrayDeque 
		Deque<String> de_que = new ArrayDeque<String>(); 

		// Use add() method to add elements into the Deque 
		de_que.add("Welcome"); 
		de_que.add("To"); 
		de_que.add("Geeks"); 
		de_que.add("4"); 
		de_que.add("Geeks"); 

		// Displaying the ArrayDeque 
		System.out.println("ArrayDeque: " + de_que); 

		// Verifying if the Deque is empty or not 
		System.out.println("The Deque is empty? " + 
									de_que.isEmpty()); 

		// Clearing the deque 
		de_que.clear(); 

		// Verifying if the Deque is empty or not 
		System.out.println("The Deque is empty? " + 
									de_que.isEmpty()); 
	} 
} 

Output:

ArrayDeque: [Welcome, To, Geeks, 4, Geeks]
The Deque is empty? false
The Deque is empty? true

ArrayDeque clear() Method in Java

The Java.util.ArrayDeque.clear() method in Java is used to remove all of the elements from the Deque. Using the clear() method only clears all the element from the deque and does not delete the deque. In other words, it can be said that the clear() method is used to only empty an existing ArrayDeque.

Syntax:

Array_Deque.clear()

Parameters: The method does not take any parameter.

Return Value: The function does not return any value.

Below programs illustrate the Java.util.ArrayDeque.clear() method:
Program 1:

// Java code to illustrate clear() 
import java.util.*; 

public class ArrayDequeDemo { 
	public static void main(String args[]) 
	{ 
		// Creating an empty ArrayDeque 
		Deque<String> de_que = new ArrayDeque<String>(); 

		// Use add() method to add elements into the Deque 
		de_que.add("Welcome"); 
		de_que.add("To"); 
		de_que.add("Geeks"); 
		de_que.add("4"); 
		de_que.add("Geeks"); 

		// Displaying the ArrayDeque 
		System.out.println("ArrayDeque: " + de_que); 

		// Clearing the Deque 
		de_que.clear(); 

		// Displaying the Deque 
		System.out.println("ArrayDeque: " + de_que); 
	} 
} 

Output:

ArrayDeque: [Welcome, To, Geeks, 4, Geeks]
ArrayDeque: []

ArrayDeque size() Method in Java

The Java.util.ArrayDeque.size() method in Java is used to get the size of the Deque or the number of elements present in the Deque.

Syntax:

Array_Deque.size()

Parameters: The method does not take any parameter.

Return Value: The method returns the size or the number of elements present in the Deque.

Below programs illustrate the Java.util.ArrayDeque.size() method:
Program 1: Adding String elements into the Deque.

// Java code to illustrate size() 
import java.util.*; 

public class ArrayDequeDemo { 
	public static void main(String args[]) 
	{ 
		// Creating an empty ArrayDeque 
		Deque<String> de_que = new ArrayDeque<String>(); 

		// Use add() method to add elements into the Deque 
		de_que.add("Welcome"); 
		de_que.add("To"); 
		de_que.add("Geeks"); 
		de_que.add("4"); 
		de_que.add("Geeks"); 

		// Displaying the ArrayDeque 
		System.out.println("ArrayDeque: " + de_que); 

		// Displaying the size of Deque 
		System.out.println("The size is: " + de_que.size()); 
	} 
} 

Output:

ArrayDeque: [Welcome, To, Geeks, 4, Geeks]
The size is: 5

ArrayDeque contains() Method in Java

The Java.util.ArrayDeque.contains() method in Java is used to check or verify whether a specific element is present in the Deque or not.

Syntax:

Array_Deque.contains(Object element)

Parameters: The parameter element is of the type of ArrayDeque. This is the element that needs to be tested if it is present in the deque or not.

Return Value: The method returns True if the element is present in the deque otherwise it returns False.

Below programs illustrate the Java.util.ArrayDeque.contains() method:
Program 1:

// Java code to illustrate contains() 
import java.util.*; 

public class ArrayDequeDemo { 
	public static void main(String args[]) 
	{ 
		// Creating an empty ArrayDeque 
		Deque<String> de_que = new ArrayDeque<String>(); 

		// Use add() method to add elements into the Queue 
		de_que.add("Welcome"); 
		de_que.add("To"); 
		de_que.add("Geeks"); 
		de_que.add("4"); 
		de_que.add("Geeks"); 

		// Displaying the ArrayDeque 
		System.out.println("ArrayDeque: " + de_que); 

		// Check for "Geeks" in the deque 
		System.out.println("Does the deque contains 'Geeks'? "
						+ de_que.contains("Geeks")); 

		// Check for "4" in the deque 
		System.out.println("Does the deque contains '4'? "
						+ de_que.contains("4")); 

		// Check if the deque contains "No" 
		System.out.println("Does the deque contains 'No'? "
						+ de_que.contains("No")); 
	} 
} 

Output:

ArrayDeque: [Welcome, To, Geeks, 4, Geeks]
Does the deque contains 'Geeks'? true
Does the deque contains '4'? true
Does the deque contains 'No'? false

ArrayDeque iterator() Method in Java

The Java.util.ArrayDeque.iterator() method is used to return an iterator of the elements of the ArrayDeque.

Syntax:

Iterator iterate_value = Array_Deque.iterator();

Parameters: The method does not take any parameter.

Return Value: The method iterates over the elements of the deque and returns the values(iterator).

Below programs illustrate the Java.util.ArrayDeque.iterator() method:
Program 1:

// Java code to illustrate iterator() 
import java.util.*; 

public class ArrayDequeDemo { 
	public static void main(String args[]) 
	{ 
		// Creating an empty ArrayDeque 
		Deque<String> de_que = new ArrayDeque<String>(); 

		// Use add() method to add elements into the Queue 
		de_que.add("Welcome"); 
		de_que.add("To"); 
		de_que.add("Geeks"); 
		de_que.add("4"); 
		de_que.add("Geeks"); 

		// Displaying the ArrayDeque 
		System.out.println("ArrayDeque: " + de_que); 

		// Creating an iterator 
		Iterator value = de_que.iterator(); 

		// Displaying the values after iterating through the Deque 
		System.out.println("The iterator values are: "); 
		while (value.hasNext()) { 
			System.out.println(value.next()); 
		} 
	} 
} 

Output:

ArrayDeque: [Welcome, To, Geeks, 4, Geeks]
The iterator values are: 
Welcome
To
Geeks
4
Geeks

ArrayDeque getLast() Method in Java

The java.util.ArrayDeque.getLast() method in Java is used to retrieve or fetch the last element of the ArrayDeque. In the process, the method does not delete the element from the deque instead it just returns the last element of the deque.

Syntax:

Array_Deque.getLast()

Parameters: The method does not take any parameter.

Return Value: The method returns the last element present in the Deque.

Below programs illustrate the Java.util.ArrayDeque.getLast() method:

Program 1:

// Java code to illustrate getLast() method of ArrayDeque 
import java.util.*; 

public class ArrayDequeDemo { 
	public static void main(String args[]) 
	{ 
		// Creating an empty ArrayDeque 
		ArrayDeque<String> de_que = new ArrayDeque<String>(); 

		// Use add() method to add elements into the Deque 
		de_que.add("Welcome"); 
		de_que.add("To"); 
		de_que.add("Geeks"); 
		de_que.add("4"); 
		de_que.add("Geeks"); 

		// Displaying the ArrayDeque 
		System.out.println("ArrayDeque: " + de_que); 

		// Displaying the Last element 
		System.out.println("The last element is: " + de_que.getLast()); 
	} 
} 

Output:

ArrayDeque: [Welcome, To, Geeks, 4, Geeks]
The last element is: Geeks

ArrayDeque element() Method in Java

The java.util.ArrayDeque.element() method in Java is used to retrieve or fetch the head of the ArrayDeque. In the process, the method does not delete the element from the deque instead it just returns the element.

Syntax:

Array_Deque.element()

Parameters: The method does not take any parameter.

Return Value: The method returns the element present at the head of the Deque.

Below programs illustrate the Java.util.ArrayDeque.element() method:
Program 1:

// Java code to illustrate ArrayDeque element() method 
import java.util.*; 

public class ArrayDequeDemo { 
	public static void main(String args[]) 
	{ 
		// Creating an empty ArrayDeque 
		ArrayDeque<String> de_que = new ArrayDeque<String>(); 

		// Use add() method to add elements into the Deque 
		de_que.add("Welcome"); 
		de_que.add("To"); 
		de_que.add("Geeks"); 
		de_que.add("4"); 
		de_que.add("Geeks"); 

		// Displaying the ArrayDeque 
		System.out.println("ArrayDeque: " + de_que); 

		// Displaying the head 
		System.out.println("The head element is: " + de_que.element()); 
	} 
} 

Output:

ArrayDeque: [Welcome, To, Geeks, 4, Geeks]
The head element is: Welcome

 

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/191300.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • scope=prototype有什么作用_prototype和单例模式

    scope=prototype有什么作用_prototype和单例模式@Scope(“prototype”)//多例模式

    2022年8月19日
    7
  • mysql数据库——连接查询(内连接:自然连接,等值连接。外连接:左连接,右连接,全连接)「建议收藏」

    mysql数据库——连接查询(内连接:自然连接,等值连接。外连接:左连接,右连接,全连接)「建议收藏」????这里是数据库加油站????如果对你有帮助,给博主一个免费的点赞以示鼓励欢迎各位????点赞????评论收藏⭐️数据库版本:mysql8。0.27如果以下代码执行有问题欢迎留言,一起探讨文章目录内连接自然连接和等值连接的区别内连接的实现方式外连接左连接右连接全连接内连接内连接INNERJOIN是最常用的连接操作。从数学的角度讲就是求两个表的交集,从笛卡尔积的角度讲就是从笛卡尔积中挑出ON子句条件成立的记录。在我看来内连接和等值连接差不多,自然连接是内连接中的一个特殊连接自然连接和

    2022年6月8日
    31
  • pycharm配置pytorch的坑以及解决方案「建议收藏」

    pycharm配置pytorch的坑以及解决方案「建议收藏」1.好像不支持python3.8。直接从setting里面安装时不行的,按其它教程(https://blog.csdn.net/lyz21/article/details/104295042)从官网https://pytorch.org/get-started/locally/,拷贝链接用pip下载,一直报找不到版本。后来发现,python3.8的原因,改成python3.7可以了,但会一直连接超时。2.发现要下载的其实是这两个文件:点开下面的两个链接,用下载软件下载了,我下到了e盘,直接pip

    2025年6月10日
    3
  • SecureCRTPortable工具中文乱码解决办法

    SecureCRTPortable工具中文乱码解决办法今天使用SecureCRTPortable工具连接Linux操作时,发现出现了乱码的问题,解决方法如下:这样就解决了乱码的问题了,当然,大家遇到的问题可能一样,但解决的方法不一定都好使,希望有所帮助…

    2022年4月29日
    37
  • pytest测试框架和unittest_pytest测试框架从入门到精通

    pytest测试框架和unittest_pytest测试框架从入门到精通运行unittest时要保证默认测试环境是unittest

    2022年10月9日
    6
  • RapidXML问题

    RapidXML问题XML在编程中会经常应用RapidXML就是用C++实现的一种XML工具它是开源、灵活且高效的仅仅由4个头文件组成,可以直接编译到项目当中。rapidxml.hpprapidxml_utils.hpprapidxml_print.hpprapidxml_iterators.hpp在Linux或者Qt等环境想使用rapidxml_print.hpp中的类会有声明的问题,所以可以在文件的104行处插入如下代码template<classOutIt,classCh>inli

    2022年7月17日
    16

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号